[英]AngularJS make a simple group by
我在AngularJS中遇到了麻煩。 這是我的代碼:
<div class="ibox float-e-margins collapsed">
<div ng-repeat="(key, value) in costList | groupBy: 'Month'">
{{group}}
<ul>
<li ng-repeat="costList in value">
</li>
</ul>
</div>
</div>
當我放| groupBy: 'Month'
| groupBy: 'Month'
代碼中的| groupBy: 'Month'
顯示錯誤:
Error: [$injector:unpr] http://errors.angularjs.org/1.6.6/$injector/unpr?p0=groupByFilterProvider%20%3C-%20groupByFilter
at angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:14
at angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:53
at Object.d [as get] (angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:50)
at angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:53
at Object.d [as get] (angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:50)
at angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:173
at V (angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:134)
at angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:132
at p (angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:15)
at V (angularjs?v=3IGOL90Rnusy-QTWOoBPXNF6utfbZEM46kAny3Khxb81:132) "<!-- ngRepeat: (key, value) in costList | groupBy: '[Month]' -->"
我以為我缺少一些依賴性,但是我不知道我缺少哪個文件。
js文件如下,
var app = angular.module('BusinessTripBudget', ['angular.filter']);
app.controller('Budget', ["$scope", "$http", "$window", "$compile", "$q",
function ($scope, $http, $window, $compile, $q) {
//Here I put the code that retrieves data
}]);
我正在使用AngularJS v1.6.6
這是我的腳本順序:
jquery-ui.min.js
angular.min.js
MyCustomJS.js
錯誤表明缺少角度過濾器模塊
請按照以下步驟
在包含Angular本身之后,在您的index.html中包含angular-filter.js(或angular-filter.min.js)。
將“ angular.filter”添加到主模塊的依賴項列表中。
按照步驟從https://github.com/a8m/angular-filter添加依賴項
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.