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 Emberjs-CollectionView中的把手动作_Ember.js - Fatal编程技术网

Ember.js Emberjs-CollectionView中的把手动作

Ember.js Emberjs-CollectionView中的把手动作,ember.js,Ember.js,我这里有个奇怪的问题。我想捕获父视图中渲染的Ember.CollectionView中的操作 {{#collection contentBinding="view.content"}} <a href="#" {{action insideCollection target="parentView">{{view.content}}</a> {{/collection}} 但是CollectionView中的parentView仍然是一个视图的子类,而不是在我的

我这里有个奇怪的问题。我想捕获父视图中渲染的Ember.CollectionView中的操作

{{#collection contentBinding="view.content"}}
    <a href="#" {{action insideCollection target="parentView">{{view.content}}</a>
{{/collection}}
但是CollectionView中的parentView仍然是一个视图的子类,而不是在我的示例ApplicationView中的parentView本身。那么,如何在ApplicationView中捕捉把手动作呢

这里有一把小提琴,你可以自己看问题:

有什么想法吗?

使用集合帮助器时,会为块中的每个内容创建一个隐式视图。因此,在这里,如果要访问ApplicationView,必须调用两次parentView

{{#collection contentBinding="view.content"}}
    <a href="#" {{action insideCollection target="parentView">{{view.content}}</a>
{{/collection}}
第二个提示是,必须使用关键字view作为该链的前缀,才能访问当前视图属性

<script type="text/x-handlebars" data-template-name="application">
  <h1>Hello from Ember.js</h1>
  <button {{action test target="view"}}>Click to Test</button>
  {{#collection contentBinding="view.content" tagName="ul"}}
    <a href="#" {{action insideAction target="parentView.parentView"}}>{{view.content}}</a>
 {{/collection}}
</script>​
使用集合辅助对象时,会为块中的每个内容创建一个隐式视图。因此,在这里,如果要访问ApplicationView,必须调用两次parentView

{{#collection contentBinding="view.content"}}
    <a href="#" {{action insideCollection target="parentView">{{view.content}}</a>
{{/collection}}
第二个提示是,必须使用关键字view作为该链的前缀,才能访问当前视图属性

<script type="text/x-handlebars" data-template-name="application">
  <h1>Hello from Ember.js</h1>
  <button {{action test target="view"}}>Click to Test</button>
  {{#collection contentBinding="view.content" tagName="ul"}}
    <a href="#" {{action insideAction target="parentView.parentView"}}>{{view.content}}</a>
 {{/collection}}
</script>​