Angularjs 1.6 Application Bug: Turning Items Pagination Into A Service Does Not Work
I am making a small Contacts application with Bootstrap 4 and AngularJS v1.6.6. The application simply displays an Users JSON. Since the JSON returns a large number of users, the
Solution 1:
It appears that the service needs to be defined before the controller, otherwise it cannot be injected properly.
So you could either move the paginationService
into app.js
:
var app = angular.module("contactsApp", []);
app.factory('paginationService', function(){
//...
});
app.controller("contactsCtrl", ["$scope", "$http", "$filter", "paginationService", function($scope, $http, $filter) {
//...
});
Or else move the controller out to a separate file that is included after the paginationServices.js
file.
Take a look at this plunker. Try modifying line 6 - remove character 5, i.e. the space that separates the star and slash that would close the multi-line comment.
Post a Comment for "Angularjs 1.6 Application Bug: Turning Items Pagination Into A Service Does Not Work"