javascript - Inject an object into a service function -


i have been struggling few hours without getting solution. how can inject object function, can use in there? example:

angular.module(modulename).service('myservice', myservice, myobject); 

here, myobject defined, ok. then, inside function, undefined. how can pass object function , use in there?

camundaservice.$inject = ['$http']; function camundaservice($http, myobject) {...} 

injecting second parameter in array did not work , error:

angular.js:13708 error: [$injector:unpr] unknown provider 

any appreciated :)

you can use angular constant:

var app = angular.module('myapp', []);  app.constant('myobject', {     message: 'hello world' }); 

now can inject myobject.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -