Answer the question
In order to leave comments, you need to log in
Error using service in your service?
angular.module('cool')
.provider('AllComment', function ($http) {
var ctrl = 'AllCommentCtrl';
return {
setCtrl: function (data) {
ctrl = data;
return this;
},
$get: function () {
console.log(ctrl);
}
}
});
Answer the question
In order to leave comments, you need to log in
Update: It's wrong to edit the code this way. See: stackoverflow.com/questions/17497006/use-http-insi...
Correct the code a bit:
angular.module('cool')
.provider('AllComment', ["$http", function ($http) {
var ctrl = 'AllCommentCtrl';
return {
setCtrl: function (data) {
ctrl = data;
return this;
},
$get: function () {
console.log(ctrl);
}
}
}]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question