【发布时间】:2014-05-14 16:42:45
【问题描述】:
嗨,我对 ember js 很陌生。我在模板中的链接到操作上传递操作参数(id),但我没有在我的控制器中获得值。
我的模板代码如下:
index.html:
<script type="text/x-handlebars" data-template-name="search">
{{#each model.results}}
// here i pass id value along with action
{{#link-to 'profile' id action="profileinfo"}}
</script>
app.js:
App.SearchController = Ember.ObjectController.extend({
id: '',
actions:{
profileinfo: function(id){
// Here i access id value like this
console.log(id);
var id = this.get('id');})
当我单击链接操作转到 Searchcontroller 时,但我得到的 id 值为空。我在堆栈溢出中遵循了一些解决方案,但不幸的是我没有得到任何东西。请提供一些解决方案
【问题讨论】:
-
你已经为此给出了python标签,即使它很明显不是python
标签: ember.js