【发布时间】:2014-10-24 21:17:02
【问题描述】:
我是JS的新手。
我正在尝试执行以下调用:
this.compiled(_.extend(this.terminals[i], {clazz: 'all'}, obj));
在调试中我看到了
_.extend(this.terminals[i], {clazz: 'all'}, obj)
返回
Object {terminalId: 3, city: Object, street: "Победы", houseNumber: "5", cost: 1…}city: Objectid: 1name: "Москва"__proto__: Objectclazz: "all"clazz2: ""cost: 1description: "Третий терминал"houseNumber: "5"id: 3mapLat: 55.57834420000001mapLng: 37.59668899999999numberOfCase: 0numberOfEmptyCase: 0numberShow: 0street: "Победы"terminalId: 3timeOfShow: 0__proto__: Object
在控制台之后我看到了
Uncaught ReferenceError: place is not defined VM141:16
(anonymous function) VM141:16
template underscore.js:1269
window.MARC.addTerminalPage.showTerminalsMain. addTerminal:792
renderTerminalsOnMap addTerminal:1144
k jquery-1.8.2.min.js:2
l. fireWith jquery-1.8.2.min.js:2
y jquery-1.8.2.min.js:2send.d
问题的原因是什么以及如何解决?
更新:
更多细节:
message: "place is not defined"stack: "ReferenceError: place is not defined↵ at Object.eval (eval at <anonymous> (http://localhost:9090/resources/js/underscore.js:1261:16), <anonymous>:16:9)↵ at Object._.template.template [as compiled] (http://localhost:9090/resources/js/underscore.js:1269:21)↵ at Object.eval (eval at evaluate (unknown source), <anonymous>:2:6)↵ at Object.InjectedScript._evaluateOn (<anonymous>:732:103)↵ at Object.InjectedScript._evaluateAndWrap (<anonymous>:665:34)↵ at Object.InjectedScript.evaluateOnCallFrame (<anonymous>:783:21)↵ at Object.window.MARC.addTerminalPage.showTerminalsMain (http://localhost:9090/member/createCompany/addTerminal:792:50)↵ at Object.renderTerminalsOnMap [as success] (http://localhost:9090/member/createCompany/addTerminal:1144:37)↵ at p.Callbacks.k (http://localhost:9090/resources/js/jquery-1.8.2.min.js:2:16920)↵ at Object.p.Callbacks.l.fireWith [as resolveWith] (http://localhost:9090/resources/js/jquery-1.8.2.min.js:2:17707)"
【问题讨论】:
-
什么是VM141? 'place' 是您在代码中使用的某个变量吗?
标签: javascript templates exception underscore.js