我收到以下错误:
Error: Non-assignable model expression: undefined (directive: leaflet)
at Error (<anonymous>)
at h (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:43:213)
at Object.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:43:326)
at Object.e.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:87:13)
at Object.e.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:89:198)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:16:239
at Object.d [as invoke] (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:28:96)
at c (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:16:160)
at tb (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:16:356)
at lc (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js:16:4) angular.min.js:63
(anonymous function) angular.min.js:63
除了我正在尝试调试上述错误之外,我想问一下调试代码的最佳方法是什么,因为上面的错误没有显示原始代码上的错误行但是在angular.min.js文件?
答案 0 :(得分:1)
好吧,如果我看到这个错误,我要做的第一件事就是检查具有leaflet指令的元素,然后检查其中的表达式。像这样
<div leaflet="whatever you have here is undefined"></div>
嗯,无论如何,这正是棱角分明的告诉我。
您还可以使用angular.js的Batarang调试扩展