正如您在此jsbin中所看到的,我正在尝试执行以下操作:
FIXTURE
缓慢加载的,因为latency
中的FIXTURE
为Loading ...
。controllers.nodesIndex.isUpdating
我尝试使用isLoading
,isUpdated
,.isLoaded
dataLoaded
以及其他几种变体,但这不起作用。我如何应对“数据就绪”事件?
我也尝试过绑定Uncaught Error: Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.
Assertion failed: Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change notifications
Uncaught Error: You cannot modify child views while in the inBuffer state
的属性;在路由中,当收到数据时,我手动更新属性。但这也行不通。我收到几条错误消息:
<div id="legend" class="">
<legend class="">Nodes <span class="badge">{{controllers.nodesIndex.length}} records</span></legend>
</div>
<!-- Just to get visual feedback when the data gets loaded -->
{{outlet}}
{{#if controllers.nodesIndex.dataLoaded}}
<!-- This should only be shown when the data is ready -->
{{outlet}}
{{else}}
Loading ...
{{/if}}
</fieldset>
</form>
</article>
这是模板:
App.NodesIndexController = Ember.ArrayController.extend({
dataLoadedBinding: 'App.nodesLoaded'
});
这是控制器:
App.NodesIndexRoute = Ember.Route.extend({
model: function() {
return App.Node.find().then(function(data) {
console.log('Data received > data=%o', data);
App.set('nodesLoaded', true);
return data;
});
}
});
这就是路线:
{{1}}
答案 0 :(得分:2)
在加载内容的句柄中提供备用标记的规范方法似乎是控制器的isUpdating
属性content
。
{{#if content.isUpdating}}
{{!-- content markup here --}}
{{else}}
{{!-- Loading message here --}}
{{/if}}