angularjs - karma error: [$injector:unpr] Unknown provider: ngTableParamsProvider <- ngTableParams -


here controller:

var myapp = angular.module('legalcontrollers', []); myapp.controller('lemel', ['$scope', '$http', '$location', 'ngtableparams', '$filter', '$q', function ($scope, $http, $location, ngtableparams, $filter, $q) {     $scope.list = function () {         $scope.enrollmentpromise = $http.get('./ccs/enrollment/activelist').success(function (data) {             $scope.data = data;             $scope.tableparams.reload();         });     }; }]); 

and spec:

 describe('controller: lemel', function() {      beforeeach(inject(function($controller) {          scope = {};          $controller('lemel', {$scope: scope});      }));       it('check list function defined or not', function() {          expect('list').tobedefined();      });  }); 

karma throws: error: [$injector:unpr] unknown provider: ngtableparamsprovider <-ngtableparams

please 1 me. in advance.

first add ngtableparams dependency of module

var myapp = angular.module('legalcontrollers', ['ngtableparams']); 

then inject $rootscope before tests , use when instantiating controller.

  var ctrl;   beforeeach(inject(function ($rootscope, $controller) {     $scope = $rootscope.$new();     ctrl = $controller('lemel', {$scope: $scope});   })); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

config - arch-linux qtile keybinds no reaction -