Prateek Prateek - 5 months ago 622
AngularJS Question

Error: [$injector:unpr] Unknown provider: ngTableParamsProvider <- ngTableParams

I am trying to use ng-table and tried adding it on many places but its giving error for all cases.

When I am adding

ngTable
in app.js, its giving:


Error: [$injector:unpr] Unknown provider: ngTableParamsProvider <- ngTableParams


When I am adding
ngTable
in controller, its giving undefined is not a function for controller.

How should I resolve it?

Answer

You need

  1. Add reference to <script src="....ng-table.js"></script> (more likely in in your index.html file)
  2. Inject ngTable to your angular module ie:

    var myApp = angular.module('myApp',['ngTable']);

  3. in controller

    myApp.controller('someCtrl', function($scope, ngTableParams) {....});