0
我很新的angularjs.My問題很簡單。我有一個控制器在JavaScript中顯示候選人結果,我想顯示候選人的詳細信息。模型綁定與angularjs和mvc4不工作
//For displaying Candidate List
var Listcandidates = $resource('/api/Candidate', {}, { update: { method: 'GET' } });
$scope.candidateslist = [];
$scope.candidate = {};
Listcandidates.query(function (data) {
$scope.candidateslist.length = 0;
angular.forEach(data, function (CandidateData) {
$scope.candidateslist.push(CandidateData);
})
});
//For displaying candidate details
$scope.editCandidate = function (id) {
var Canid = String(id);
$location.path("/editCandidate/" + id);
$http({ method: 'GET', url: '/api/Candidate', params: { Candidateid: Canid } }).success(function (data, status, headers, config) {
$scope.candidate = data;
});
}
EditCandidate.html
<div class="control-group" >
<input type="text" name="title" ng-model="candidate.name" class="span3" />
</div>
我已經給在editcandidate正確警告,並顯示數據,但在EditCandidate.html不能得到model.Plz幫助我。