此HTML邀请按钮单击:
<p><button class="btn btn-info" ng-click="ResetEventStation()">
Choose a different station</button></p>
Run Code Online (Sandbox Code Playgroud)
哪个调用此函数:
$scope.ResetEventStation = function()
{
localStorage.removeItem("stationId");
localStorage.removeItem("stationName");
localStorage.removeItem("isRegistrationStation");
$scope.stationId = -1;
$scope.stationName = '';
$scope.isRegistrationStation = false;
}
Run Code Online (Sandbox Code Playgroud)
我可以断点并单步执行该函数,但是当我跨过右括号时,我得到
angular.js:13236错误:[orderBy:notarray]预期的数组,但收到了:{“ customer_id”:97,“ event_id”:6,“ station_id”:7,“ station_name”:“圣潘克拉斯”,“ customer_name”: “ mawg”,“ event_title”:“事件一”,“令牌”:“ 20000097-6ee02241-7231-4f8d-9956-5cf5022de147”} http://errors.angularjs.org/1.5.0/orderBy/notarray?p0 =%7B%22customer_id%22%…%22%2C%22token%22%3A%2220000097-6ee02241-7231-4f8d-9956-5cf5022de147%22%7D at angular.js:68 at angular.js:20410 at fn(在编译时评估(angular.js: 14086)、: 4:200)(位于Scope。$ digest(angular.js:16655)(位于ChildScope)的regularInterceptedExpression(angular.js:15213).HTMLButtonElement的$ apply(angular.js:16928))。(htmlularElement.dispatch)(angular.js:24551)(jquery-2.1.1.min.js:3)(HTMLQueryElement.r.handle(jquery-2.1.1.min.js:3)
谷歌搜索显示它是一个过滤器错误,而且,可以肯定的是,浏览器控制台显示了此功能,我假设Angular为我生成了该功能:
(function($filter,ensureSafeMemberName,ensureSafeObject,ensureSafeFunction,getStringValue,ensureSafeAssignContext,ifDefined,plus,text
/*``*/) {
"use strict";
var fn=function(s,l,a,i){var v0,v1,v2,v3=l&&('ResetEventStation' in l);v2=v3?l:s;if(!(v3)){if(s){v1=s.ResetEventStation;}}else{v1=l.ResetEventStation;}ensureSafeObject(v1,text);if(v1!=null){ensureSafeFunction(v1,text);v0=ensureSafeObject(v2.ResetEventStation(),text);}else{v0=undefined;}return v0;};return fn;
})
Run Code Online (Sandbox Code Playgroud)
我不太了解发生了什么。有人可以告诉我我做错了什么,以及如何纠正错误?
我可以看到它{"customer_id":97,"event_id":6,"station_id":7,"station_name":"St. Pancras","customer_name":"mawg","event_title":"Event one","token":"20000097-6ee02241-7231-4f8d-9956-5cf5022de147"}不是数组,但是不确定为什么要引用它。
| 归档时间: |
|
| 查看次数: |
1387 次 |
| 最近记录: |