cancel
Showing results for 
Search instead for 
Did you mean: 

angular-nuxeo : attach a blob through uploader ? - [SOLVED]

freemann_
Star Contributor
Star Contributor

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

1 ACCEPTED ANSWER

Thomas_Roger
Star Contributor
Star Contributor

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.

View answer in original post

16 REPLIES 16

Here is a sample of my code

freemann_
Star Contributor
Star Contributor

Hi Thomas,

Do you have something for me about "put your application URL behind the Authentication filter" for using angular with nuxeo on jasig CAS nuxeo server?

A sample or example.

Thanks