Alfresco / alfresco-js-api

This project provides a JavaScript client API into the Alfresco REST API and Activiti REST API.
Apache License 2.0
118 stars 62 forks source link

Error if using the WebscriptApi in an ADF2.1 project #302

Closed akolybelnikov closed 6 years ago

akolybelnikov commented 6 years ago

Type of issue: (check with "[x]")

- [ ] New feature request
- [X] Bug  
- [ ] Support request

Current behavior: If imported and declared like so:

import { WebscriptApi } from 'alfresco-js-api';
.......
constructor(
    private webscriptApi: WebscriptApi
    ) { }

and then used in a service like so:

  getWebscript(url) {
    return this.webscriptApi.executeWebScript('GET', url')
      .then(function (data) {
        console.log('Data received: ', data);
     }, function (error) {
        console.log('Error', error);
     });
  }

an error message from Angular/CLI comes up:

Uncaught Error: Can't resolve all parameters for Service: ([object Object], [object Object], ?).

Expected behavior: The service shoud provide GET/POST/PUT/DELETE methods directly accessible from an ng2 component. Alternatively, the WebscriptComponent could provide additional methods besides GET

Steps to reproduce the issue: (see above)

Node version (for build issues):
v8.9.4

New feature request:

DenysVuika commented 6 years ago

alfresco-js-api is a framework agnostic project, in order to use it in the Angular please refer to corresponding Angular Services (i.e. AlfrescoApiService)

eromano commented 6 years ago

this is an example how to use it in angular from ADF

  constructor(private apiService: AlfrescoApiService) {}
this.apiService.getInstance().webScript.executeWebScript('post', this.scriptPath, this.scriptArgs, this.contextRoot, this.servicePath).then((webScriptdata) => {

you can pass all the supported verb you want. For more information about this method in the alfresco-js-api:

https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/WebscriptApi.md