I have written this code using a service in angular.js. Upon running the code, I encountered an error Uncaught Error: [ng:areq].
</ons-toolbar>
<div ng-controller="testAppController">
Search: <input ng-model="query" type="text" class="text-input" id="my-input"/>
<table>
<tr>
<th>Country</th>
<th>Population</th>
</tr>
<tr ng-repeat="country in countries | filter:query">
<td>{{country.name}}</td>
<td>{{country.population}}</td>
</tr>
</table>
</div>
<div ng-include='"partials/footer.html"'></div>
</ons-page>
demo.js
angular.module('testsapp',[])
.service('helloworldservice',function($http){
this.getDatafunction = function(){
$http.get('json/countries.json')
.success(function(data) {
alert("sucesss");
})
.error(function(data) {
alert("wrong");
});
}
})
.controller('testAppController',['helloworldservice',function($scope,helloworldservice){
helloworldservice.getDatafunction();
}]);