0
我有我的控制器和模型。我试图访问模式控制器内部这样 App.AssignmentController = Ember.ArrayController.extend({无法访问控制器内的Ember模型数据
App = Ember.Application.create({});
App.Router.map(function() {
this.resource('assignment',{path:'about'});
});
App.AssignmentAdapter = DS.RESTAdapter.extend({
findQuery: function(store, type, queryData) {
var findQueryURL = 'http://local_env.mhhe.com/openapi/lms/coversheet/sectionid/241409387/assignmentid/14706368/userid/61/isangelinstallation/false/returnUrl/bb';
return this.ajax(findQueryURL, 'POST', {
data: queryData.query
})
}
});
App.AssignmentRoute = Ember.Route.extend({
model: function() {
return this.store.findQuery('assignment','1');
},
});
var attr = DS.attr;
App.Assignment = DS.Model.extend({
assignmentId: attr('number'),
sectionId:attr('number'),
assignmentType:attr('string'),
assignmentTitle:attr('string'),
assignmentStartDate:attr('string'),
assignmentStartTime:attr('string'),
assignmentDueDate:attr('string'),
assignmentDueTime:attr('string'),
isMarathonChain:attr('boolean'),
assignmentTimeLimit:attr('number'),
assignmentTimeRemaining:attr('number'),
marathonAssignmentStatus:attr('string'),
showAssignmentAttemptsAndPasswordDetails:attr('boolean'),
assignmentAttemptsTaken:attr('number'),
assignmentAttemptsAllowed:attr('number'),
showPasswordForm:attr('boolean'),
isStartAssignment:attr('boolean'),
isResumeAssignment:attr('boolean'),
isSubmitAssignment:attr('boolean'),
passwordRequired:attr('boolean'),
isConvertToGeniusEnabled:attr('boolean'),
draftNumber:attr('number'),
studentExceptionExistsForDueDate:attr('boolean'),
isPastUploadDate:attr('boolean'),
showMarathonPrerequisiteInfo:attr('boolean')
});
App.AssignmentController = Ember.ArrayController.extend({
displayAssignments: function(){
var assignments = this.get('model.assignment');
// i also tried this.store.find but that also didnt gave me the output
return assignments;
}.property('model.assignment'),
});
我现在想访问此控制器内这种模式,但我无法访问它。这里,在这个控制器我将操纵一些额外的条件,并使用这在我的模板检查一些条件。
我也这样做,但现在还我没有得到从我的控制器的任何事情。它返回undefined。还有一件事我注意到,通过在该控制器中放置调试点,当它来到该控制器时,我的模型未设置,并且一旦我按下F8并从中出来,我的模型将设置为所有值。这可能是一个问题吗? – 2014-12-03 07:23:12