0

I am having trouble setting up the Angular / bootstrap for my app

I am following this page's pagination intro.

http://angular-ui.github.io/bootstrap/

My app.js

angular.module('myApp', ['ngRoute','ui.bootstrap']).
    config(['$routeProvider', function($routeProvider) {
       ….
}]);

controller.js

angular.module('myApp', ['ngRoute']).
controller('PaginationCtrl',['$scope', function ($scope) {
  $scope.totalItems = 64;
  $scope.currentPage = 4;
  $scope.maxSize = 5;

  $scope.setPage = function (pageNo) {
    $scope.currentPage = pageNo;
  };

  $scope.bigTotalItems = 175;
  $scope.bigCurrentPage = 1;
}])

html

 <div id='pagination-wrapper' ng-controller='PaginationCtrl'>

 <pagination direction-links="false" total-items="totalItems" page="currentPage" num-pages="smallnumPages"></pagination>

</div>

I have no error when I load the page but I can't seem to see the pagination feature. Can anyone help me about it? thanks a lot!

2
  • Have you tried including 'ui.bootstrap' in the controller.js dependencies? Commented Mar 25, 2014 at 23:42
  • I got an dependency injection error if I did that... Commented Mar 26, 2014 at 0:06

1 Answer 1

2

It appears the problem is with having the dependencies re-declared there. If you remove the ngRoute dependency from the controller.js module, it will work. You can also drop the example vars that you're not using.

angular.module('myApp').
    controller('PaginationCtrl',['$scope', function ($scope) {
        $scope.totalItems = 64;
        $scope.currentPage = 4;
}]);

For a working example: http://plnkr.co/edit/wpgoDrA2Z7pjXbgdNrM8?p=preview

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.