App.Exam = DS.Model.extend({
examType: attr('string'),
examDate: attr('date'),
gradeText: attr('string'),
courseName: attr('string'),
courseName__startswith: attr('string'),
typeName: attr('string'),
numberOf: attr('number'),
grade: attr('number'), });
これがコントローラーからアクセスしたいモデルです。これを使用してモデルをフィルタリングします
App.ExamController = Ember.Controller.extend({
// the initial value of the `search` property
search: ''
,query: function() {
// the current value of the text field
var queryCourseName = this.get('searchCourseName');
this.set('searchResult',App.Exam.find({courseName: queryCourseName})
}
});
これは、の結果を保存する正しい方法App.Exam.find()
ですか? searchResult
別のコントローラーからプロパティにアクセスし、値を反復処理するにはどうすればよいですか?