我很难理解 ember.js 错误。我总是必须查看所有代码并进行随机更改,因为我无法确定错误在哪里。特别是我有这个错误,修改(但在结构上保持相同)窥视代码示例:
Uncaught Error: Something you did caused a view to re-render after it rendered but
before it was inserted into the DOM. application.js:30508
Ember.merge.rerender application.js:30508
Ember.View.Ember.CoreView.extend.rerender application.js:29198
Ember.View.Ember.CoreView.extend._controllerDidChange application.js:29117
sendEvent application.js:18480
Ember.notifyObservers application.js:17033
propertyDidChange application.js:17640
iterDeps application.js:17089
dependentKeysDidChange application.js:17113
propertyDidChange application.js:17638
set application.js:16460
Ember.View.Ember.CoreView.extend.createChildView application.js:30079
Ember.ContainerView.Ember.View.extend.init application.js:30944
superWrapper application.js:15393
Ember._Metamorph.Ember.Mixin.create.init application.js:32704
superWrapper application.js:15393
Class application.js:24583
Mixin.create.create application.js:24842
Ember.View.Ember.CoreView.extend.createChildView application.js:30063
Ember.merge.appendChild application.js:30517
Ember.View.Ember.CoreView.extend.appendChild application.js:29931
EmberHandlebars.ViewHelper.Ember.Object.create.helper application.js:33864
get application.js:34043
get application.js:38247
EmberHandlebars.registerHelper.context application.js:33224
program1 application.js:49634
(anonymous function) application.js:14488
Ember.View.Ember.CoreView.extend.render application.js:29173
Ember.CoreView.Ember.Object.extend._renderToBuffer application.js:28180
Ember.View.Ember.CoreView.extend._renderToBuffer application.js:29728
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28159
Ember.Instrumentation.instrument application.js:15703
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28158
Ember.ContainerView.Ember.View.extend.render application.js:30985
Ember.View.Ember.CoreView.extend.forEachChildView application.js:29412
Ember.ContainerView.Ember.View.extend.render application.js:30984
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend._renderToBuffer application.js:28180
Ember.View.Ember.CoreView.extend._renderToBuffer application.js:29728
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28159
Ember.Instrumentation.instrument application.js:15703
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28158
Ember.merge.appendChild application.js:30520
Ember.View.Ember.CoreView.extend.appendChild application.js:29931
EmberHandlebars.ViewHelper.Ember.Object.create.helper application.js:33864
get application.js:34043
handlebarsGet application.js:34260
Ember.Handlebars.registerHelper.template application.js:34684
anonymous application.js:49660
(anonymous function) application.js:14452
Ember.View.Ember.CoreView.extend.render application.js:29173
Ember.CoreView.Ember.Object.extend._renderToBuffer application.js:28180
Ember.View.Ember.CoreView.extend._renderToBuffer application.js:29728
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28159
Ember.Instrumentation.instrument application.js:15703
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28158
Ember.ContainerView.Ember.View.extend.render application.js:30985
Ember.View.Ember.CoreView.extend.forEachChildView application.js:29412
Ember.ContainerView.Ember.View.extend.render application.js:30984
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend._renderToBuffer application.js:28180
Ember.View.Ember.CoreView.extend._renderToBuffer application.js:29728
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28159
Ember.Instrumentation.instrument application.js:15703
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28158
Ember.merge.appendChild application.js:30520
Ember.View.Ember.CoreView.extend.appendChild application.js:29931
EmberHandlebars.ViewHelper.Ember.Object.create.helper application.js:33864
get application.js:34043
get application.js:38247
EmberHandlebars.registerHelper.context application.js:33224
anonymous application.js:49530
(anonymous function) application.js:14452
Ember.View.Ember.CoreView.extend.render application.js:29173
Ember.CoreView.Ember.Object.extend._renderToBuffer application.js:28180
Ember.View.Ember.CoreView.extend._renderToBuffer application.js:29728
superWrapper application.js:15393
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28159
Ember.Instrumentation.instrument application.js:15703
Ember.CoreView.Ember.Object.extend.renderToBuffer application.js:28158
Ember.View.Ember.CoreView.extend.createElement application.js:29570
Ember.merge.insertElement application.js:30459
Ember.View.Ember.CoreView.extend._insertElement application.js:29502
RunLoop._prev application.js:18573
Ember.handleErrors application.js:14910
invoke application.js:18571
invokeOnceTimer application.js:19016
RunLoop._prev application.js:18573
Ember.handleErrors application.js:14910
invoke application.js:18571
iter application.js:18643
RunLoop.flush application.js:18697
RunLoop.end application.js:18602
tryable application.js:18806
Ember.tryFinally application.js:15548
Ember.run.end application.js:18809
Ember.tryFinally application.js:15550
Ember.run application.js:18765
Ember.Mixin.create.init application.js:41369
sendEvent application.js:18480
Ember.Evented.Ember.Mixin.create.trigger application.js:24352
DS.Model.Ember.Object.extend.trigger application.js:45189
superWrapper application.js:15393
states.rootState.Ember.State.create.loaded.DS.State.create.materializing.DS.State.create.firstTime.DS.State.create.exit application.js:44608
RunLoop._prev application.js:18573
Ember.handleErrors application.js:14910
invoke application.js:18571
invokeOnceTimer application.js:19016
RunLoop._prev application.js:18573
Ember.handleErrors application.js:14910
invoke application.js:18571
iter application.js:18643
RunLoop.flush application.js:18697
RunLoop.end application.js:18602
tryable application.js:18806
Ember.tryFinally application.js:15548
Ember.run.end application.js:18809
Ember.tryFinally application.js:15550
Ember.run application.js:18765
DS.RESTAdapter.DS.Adapter.extend.findAll.ajax.success application.js:49038
jQuery.Callbacks.fire application.js:1038
jQuery.Callbacks.self.fireWith application.js:1149
done application.js:8075
jQuery.ajaxTransport.send.callback
错误发生然后导航键入此地址(不导航)
transport_documents/2
。相反,如果我导航到此路径,则错误是不同的:我打开的第一个传输文档没问题,而导航到第二个我得到
You can't call renderToBufferIfNeeded on a destroyed view
Ember 是否太年轻而无法实现对开发人员有意义的错误处理,或者有什么方法可以让我更轻松地调试代码?
编辑:这是我的 hbl:
应用
<div class="container">
<div class="content">
{{outlet}}
</div>
</div>
TRANSPORT_DOCUMENTS
<table class="table table-striped">
<thead>
<tr>
<th>
n
</th>
<th>
data
</th>
<th>
Azioni
</th>
</tr>
</thead>
<tbody>
{{#each controller}}
<tr>
<td>
{{#linkTo "transport_document" this}}{{number}}{{/linkTo}}
</td>
<td>{{#linkTo "transport_document" this}}{{date}}{{/linkTo}}</td>
<td>
<a target="_blank" {{bindAttr href="printable_url"}} class="btn btn-info btn-small">
<i class="icon-white icon-print"></i>
</a>
<a target="_blank" {{bindAttr href=pdf_url}} class="btn btn-info btn-small">
<i class="icon-white icon-print"></i>
</a>
{{#linkTo transport_document this class='btn btn-warning btn-small'}}
<i class="icon-white icon-edit"></i>
{{/linkTo}}
<button {{action this.destroy target="controller"}} class='btn btn-danger btn-small'>
<i class="icon-white icon-remove"></i>
</button>
</td>
</tr>
{{outlet}}
{{/each}}
</tbody>
</table>
TRANSPORT_DOCUMENT
<p>Hello world</p>
路由器
App.Router.map ->
@route "index", path: "/"
@resource "transport_documents", ->
@route 'new'
@resource 'transport_document', {path: "/:transport_document_id"}
App.Router.reopen
location: 'history'
App.TransportDocumentsRoute = Ember.Route.extend
model: -> App.TransportDocument.find()