alfresco-ng2-components/docs/core/alfresco-api.service.md
Denys Vuika 11d38efe2b [ADF-2625] updating viewer on node editing (#3160)
* update viewer on metadata changes

* add test and docs
2018-04-10 11:00:35 +01:00

45 lines
1.1 KiB
Markdown

---
Added: v2.0.0
Status: Active
---
# Alfresco Api Service
Provides access to initialized **AlfrescoJSApi** instance.
## Basic Usage
```ts
export class MyComponent implements OnInit {
constructor(private apiService: AlfrescoApiService) {
}
ngOnInit() {
let nodeId = 'some-node-id';
let params = {};
this.apiService.getInstance().nodes
.getNodeChildren(nodeId, params)
.then(result => console.log(result));
}
}
```
## Events
| Name | Type | Description |
| --- | --- | --- |
| nodeUpdated | `Subject<MinimalNodeEntryEntity>` | Publish/subscribe to events related to node updates. |
## Details
**Note for developers**: _the TypeScript declaration files for Alfresco JS API
are still under development and some Alfresco APIs may not be accessed
via your favourite IDE's intellisense or TypeScript compiler.
In case of any TypeScript type check errors you can still call any supported
Alfresco JS api by casting the instance to `any` type like the following:_
```ts
let api: any = this.apiService.getInstance();
api.nodes.addNode('-root-', body, {});
```