如何在控制器的操作方法中调用方法 - Ember
How do I call an method in an action method in the Controller - Ember
如何用 searchSchools
调用 schoolSearchResults
?我想在调用操作 searchSchools
时更新学校列表。
export default Ember.Component.extend({
actions: {
searchSchools: function(){
//call schoolSearchResults
}
},
schoolSearchResults: function(){
alert("schoolSearch");
}
});
由 ember 组件文档
// ember 2
export default Ember.Component.extend({
actions: {
searchSchools(){
this.schoolSearchResults()
}
},
schoolSearchResults(){
this.sendAction("searchSchools");
}
});
// ember 1
export default Ember.Component.extend({
actions: {
searchSchools: function(){
this.schoolSearchResults()
}
},
schoolSearchResults: function(){
this.send("searchSchools");
}
});
如何用 searchSchools
调用 schoolSearchResults
?我想在调用操作 searchSchools
时更新学校列表。
export default Ember.Component.extend({
actions: {
searchSchools: function(){
//call schoolSearchResults
}
},
schoolSearchResults: function(){
alert("schoolSearch");
}
});
由 ember 组件文档
// ember 2
export default Ember.Component.extend({
actions: {
searchSchools(){
this.schoolSearchResults()
}
},
schoolSearchResults(){
this.sendAction("searchSchools");
}
});
// ember 1
export default Ember.Component.extend({
actions: {
searchSchools: function(){
this.schoolSearchResults()
}
},
schoolSearchResults: function(){
this.send("searchSchools");
}
});