我已经在angularJs中实现了DirPagination,它在本地运行良好,但是当我将它部署到服务器上时,它会引发错误。
[$injector:unpr]我认为这是与小型化版本相关的问题,因为在服务器上,我的所有js文件(包括控制器和应用程序)都在使用小型化版本,
Implementation简单地压缩了dirPagination.js文件和分页html文件,然后在
var App= angular.module('App', ['ngRoute', 'use', 'ngMessages', 'angularUtils.directives.dirPagination']);然后
In View
<li dir-paginate="u in list| filter:q | itemsPerPage: pageSize" current-page="currentPage">它正在与非小型化版本一起工作。
更新
我确认这是一个小型化的版本问题,因为当我将app和控制器js min移到非min文件时,它是工作的。
有什么帮助来解决这个问题吗
发布于 2017-04-27 12:06:03
您可能没有使用synthax来,在缩小时保持代码正确。
当缩小时,所有的注射都用较短的名字重新排列。让我们举个例子。
myApp.controller('MyCtrl', function($scope, $location) { ... });当缩小为:
myApp.controller('MyCtrl', function(a, b) { ... });如你所见,你失去了受抚养人的名字。
JavaScript变量被重命名,但是字符串保持不变。您应该将它更改为这个synthax (作为专家小组的建议):
myApp.controller('MyCtrl', ['$scope', '$location', function($scope, $location) { ... }]);https://stackoverflow.com/questions/43657169
复制相似问题