Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js 余烬。选择内容与内容绑定_Ember.js - Fatal编程技术网

Ember.js 余烬。选择内容与内容绑定

Ember.js 余烬。选择内容与内容绑定,ember.js,Ember.js,余烬的文档。选择使用以下内容: {{view Ember.Select content=foo ... }} 但是,本指南使用了以下内容 {{view Ember.Select contentBinding="foo" ... }} 两者都有效。首选哪一种?为什么?当您使用: {{view Ember.Select content=foo ... }} {{view Ember.Select contentBinding="foo" ... }} 您正在创建一个名为content的属性,

余烬的文档。选择使用以下内容:

{{view Ember.Select content=foo ... }}
但是,本指南使用了以下内容

{{view Ember.Select contentBinding="foo" ... }}
两者都有效。首选哪一种?为什么?

当您使用:

{{view Ember.Select content=foo ... }}
{{view Ember.Select contentBinding="foo" ... }}
您正在创建一个名为
content
的属性,该属性在视图中的值为
foo
(或来自属性
foo
)的值。在这种情况下,请选择。如果您只指定了一个值,那么如果“父”上下文中的值
foo
发生更改,则视图中不会发生任何事情。当我不需要绑定时,我使用这种方法。i、 e.传递泛型字符串时

{{view Ember.Select message="Mi message" ... }}
使用时:

{{view Ember.Select content=foo ... }}
{{view Ember.Select contentBinding="foo" ... }}
你正在建立一个新的系统。它基本上意味着将一个属性与另一个属性连接起来。当一个改变时,另一个也会改变。具体来说,这意味着视图中的
内容
属性是使用属性
foo
中的值创建的。每当属性
foo
在“父”上下文中更改时,视图中的
内容
属性也将更改。在另一个方向上也是如此,只要视图中的
content
属性发生更改,“parent”上下文中的
foo
属性就会被修改

不错的资源

我希望这对你有帮助

contentBInding=“foo”是旧语法content=foo是新语法。旧语法必须弃用


谢谢,这确实有帮助。