Histórico da Página
01. Dependências
- @angular
- Angular na versão 19
- @po-ui
- ng-components@^19
- ng-templates@^19
- subsink
- totvs/po-theme
- po-theme@^19
02. Instalação
Caso já seja um projeto existente, basta instalar a dependência do protheus-lib-core
...
| Bloco de código | ||||
|---|---|---|---|---|
| ||||
ng new my-protheus-app cd my-protheus-app ng add @po-ui/ng-components@latest ng add @po-ui/ng-templates@latest npm i subsink npm i @totvs/protheus-lib-core@latest ng serve |
03. Utilização
Para utilizar o protheus-lib-core, basta importar o módulo principal no projeto:
...
| Bloco de código | ||||
|---|---|---|---|---|
| ||||
imports: [ ProtheusLibCoreModule, ], |
04. Exemplo
Importar um dos serviços do protheus-lib-core, como o ProAppConfigService que permite a comunicação do app com a camada ADVPL, permitindo por exemplo fechar a dialog a qual o app foi aberto:
...
| Bloco de código | ||||
|---|---|---|---|---|
| ||||
private closeApp() {
if (this.proAppConfigService.insideProtheus()) {
this.proAppConfigService.callAppClose();
} else {
alert('O App não está sendo executado dentro do Protheus.');
}
} |
05. Geração do aplicativo
Gerar o app com o comando de build do Angular CLI:
...
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas