03-22-2017 03:50 AM
Hi,
I try to use angular-nuxeo to attach a blob, but I get excute exception.
Here is my code :
documentUploader(uid: string, file : File): IPromise<Object> {
let defer = this.$q.defer();
let options : any = {};
options.operationId = 'Blob.Attach';
options.client = this.nuxeo;
let myUploader : any;
myUploader = this.nuxeoClient.uploader.execute(options)
.params({
document: uid,
save : true,
xpath: "file:content"
});
myUploader.uploadFile(file)
.then((resp) => {
defer.resolve(resp);
},
(error) => {
defer.reject(error);
} );
return defer.promise;
}
How to instanciate the Uploader and then attached the blob?
Thanks for help
03-23-2017 02:28 AM
If you are in an Angular (1.x) application, you should register the client as an Angular service:
...
.service('nuxeo', function() {
return new Nuxeo({
baseURL: 'http://localhost:8080/nuxeo/',
auth: {
method: 'basic',
username: 'Administrator',
password: 'Administrator'
}
});
})
And then, you can inject nuxeo
in your controllers to use the client, such as other Angular services you may already use.
03-29-2017 01:02 AM
Hi Thomas,
03-24-2017 03:40 AM
Hi Thomas,
I think I found a little bug for Nuxeo.auth. When instanciate like this, Nuxeo._auth is always undefined :
//Instanciation de l'Object Nuxeo de la librairie
var nuxeoClient = new Nuxeo({
baseURL: nuxeoUri,
apiPath: nuxeoApi,
auth : {
method: 'basic',
username: nxUser,
password: nxPwd
},
//Activation du CORS
headers: defaultHeader
});
So I force the Auth like this and then nuxeoClient.connect(), fetch documents successfuly ;
/*Bug authentification ??
A voir Avec ToRoger de chez Nuxeo
*/
function forcerLAuth() {
nuxeoClient._auth = authentication;
}
03-24-2017 06:23 AM
Registering a "nuxeo service" as below works correctly, and I can do fetch requests
03-24-2017 06:28 AM
So, it's not possible to use a variable directly for 'auth' ? it works fine for 'baseURL', 'apiPath' and 'headers'.
03-24-2017 06:42 AM
Could you share your full code in a gist or something? I don't understand what you want to achieve.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.