![](/img/trans.png)
[英]Ember template doesn't update after saving model with EmberFire adapter for Firebase
[英]Ember template doesn't update after model update
http://jsbin.com/qoyudape/1/edit
尽管使用.pushObject()
模板不会更新。 我发现它不更新,如果不是this
我用model
或content
的模板;
什么是this
鉴于指的是如果没有模型? 是否可以使用this
而不是model
或content
使其工作?
var App = Ember.Application.create();
App.ApplicationRoute = Ember.Route.extend({
model: function(){
return Ember.A();
}
});
App.ApplicationController = Ember.ArrayController.extend({
actions: {
update: function(){
this.get("model").pushObject( Ember.Object.create({a:"b"}) );
console.log( this.get("model") );
}
}
});
模板:
<script type="text/x-handlebars">
<button {{action "update"}}>update</button>
<br><br>
{{#if this}}
array not empty
{{else}}
array empty
{{/if}}
</script>
this
是指控制器。 顺便说一句,一种简单的发现方法是在模板中进行{{log this}}
,另请参见: http : //emberjs.com/guides/understanding-ember/debugging/ 。
我实际上不确定要检查的内容是否真实/虚假,但是您始终可以使用长度。 找到后,我会更新。
{{#if this.length}}
array not empty
{{else}}
array empty
{{/if}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.