michaelbromley / angularUtils

A place where I will collect useful re-usable Angular components that I make
MIT License
2k stars 858 forks source link

dirPagination. Unknown provider: angularUtils.directives.dirPaginationProvider #440

Open Ellebkey opened 7 years ago

Ellebkey commented 7 years ago

Hi, I tried to use dirPagination system on my mean.js project but when I load it in the Angular controller it shows the next error:

Error: [$injector:unpr] Unknown provider: angularUtils.directives.dirPaginationProvider <- angularUtils.directives.dirPagination <- CoursesController

I installed the module with bower and I have the "version": "0.11.1". I added the module to my config and assets files. My Controller is like this:

angular.module('courses').controller('CoursesController', ['$scope', '$stateParams', 
                                                        '$location', 'Authentication', 
                                                        'Courses', 'Rooms', 'Periods',
                                                        'Subjects', 'ngDialog', 'notify',
                                                        'angularUtils.directives.dirPagination',

  function($scope, $stateParams, $location, Authentication, Courses, Rooms, Periods, Subjects, ngDialog, notify) {

Am I adding the wrong way the module, or what else do I have to do?

msgadi commented 7 years ago

Kindly Check that you are referencing the directive lib in scripts section. After that, Add the directive in the module like this:

angular.module('courses', [ 'angularUtils.directives.dirPagination'])

as I can see your above code, you dont need to define it again in controller once you have defined in module section.So just remove the 'angularUtils.directives.dirPagination' in your controller.

Hope it helps :)

Ellebkey commented 7 years ago

@mgadirocks Thanks, that worked. If anyone else has the same problem you have to add the module here: /modules/core/client/app/config.js

And you don't have to add it again in your controller.