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
Post a Comment