我是新的漂亮的燼寶js開發。如何將價值的餘燼視圖傳遞給控制器
我已經做視圖下方代碼
{{view "select" content=model prompt="Please select a name" selectionBinding="" optionValuePath="content.body" optionLabelPath="content.title"}}
使用以下的Json
posts = [{
title: "Raja",
body: "There are lots of à la carte software environments in this world."
}, {
title: "Broken Promises",
body: "James Coglan wrote a lengthy article about Promises in node.js."
}];
和路由器
App.InRoute = Ember.Route.extend({
model: function() {
return posts;
}
});
我的要求是使該組合框選擇的值提供給控制器
App.InController = Ember.Controller.extend({
alert("combobox selected item")
});
怎麼的我訪問值apicontoller在.NET MVC 4
public class ValuesController : ApiController
{
string value= combo box selected value
}
我試圖顯示警報動作:{ 提交:函數(){ 警報(this.get( '將selectedItem')); }顯示空值 – raj 2014-11-24 07:01:09
正如Asgaroth指出的那樣,您還可以綁定到您的模型上的某個屬性或控制器,或者可以工作。如果您使用值,請不要使用selectionBinding。 http://emberjs.com/api/classes/Ember.Select.html – 2014-11-25 14:49:47