app.provider("myService",['$http',function(){
return {
myUrl:null,
setUrl:function(url) {
myUrl = url;
},
$get:function($http) {
return {
getPerson:function() {
return $http({
method:"GET",
url:myUrl
});
}
}
}
}
}]);
This code reported such an error:
ionic.bundle.min.js:40 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.3/$injector/modulerr?p0=myApp&p1=Error%3A%2…st%3A63342%2FIonicDemo%2Flib%2Fionic%2Fjs%2Fionic.bundle.min.js%3A73%3A340
What kind of error is this? What is wrong with the above code
Will your code be compressed? If so, it is probably because there is no explicit dependency injection after $get
app.provider("myService",['$http',function(){
Change the above to function($http)
You forgot to write the parameters, so $injector error will be reported