Reputation: 1971
I am trying to make http call from my ionic app to return some json data. But it shows the error:
[$injector:nomod] Module '$http' is not available!
I think I have to add the module http to Angularjs. Please let me know how to add a new module like http to ionic framework. Thanks.
Upvotes: 0
Views: 934
Reputation: 11940
$http
is not module, it's a service, which is injected like this
angular.module('app').controller('TestController', function($scope, $http){
//use $http here
$http.get('https://stackoverflow.com').then(function(successResponse){
$scope.data = successResponse;
}, function(errorRepsonse){
$scope.error = errorRepsonse;
});
});
Upvotes: 2