I am developing a web application by using angularjs as front end. I am using ngTable for my table design. In my index.html, I add the following code.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet"; href="https://unpkg.com/[email protected]/bundles/ng-table.min.css">
<script src="https://unpkg.com/[email protected]/bundles/ng-table.min.js"></script>
Next, I add ngTable into my app.js
angular.module('AssetManagementApp', ['ngRoute','angularMoment', 'ngTable'])
But when I add ngTable into controller.js. The following is my code.
angular.module('AssetManagementApp')
.controller('PCAssetManagementController', ['$scope', '$http', function($scope, $http){
$scope.softwareTable = new ngTableParams({
page: 1,
count: 10
}, {
total: $scope.users.length,
getData: function ($defer, params) {
$scope.data = $scope.users.slice((params.page() - 1) * params.count(), params.page() * params.count());
$defer.resolve($scope.data);
}
});
}])
The web application crash when I inject 'ngTable' into controller. If I remove ngTable in controller.js. The application back to normal. However, the application still works well when the 'ngTable' is injected into app.js.