我想知道從ng-model
檢索數據的正確方法是什麼。檢索ng模型中的數據
在我ng-view
,我有這樣的代碼:
<table ng-model="logs">
<tr>
<td><input type="text" value={{logs[whichItem].Id}} readonly /></td>
</tr>
<tr>
<td><input type="text" value={{logs[whichItem].FirstName}} /></td>
</tr>
<tr>
<td><input type="text" value={{logs[whichItem].LastName}} /></td>
</tr>
<tr>
<td><input type="text" value={{logs[whichItem].Mi}} /></td>
</tr>
</table>
<div>
<input type="button" value="Update" ng-click="Update()"/>
<input type="button" value="Delete" ng-click="Delete()"/>
</div>
我想從textboxes
檢索這些數據,我試圖把一個ng-model
每個每個textbox
的,但它不工作
在我controller
,我有這樣的代碼:
logController.controller('DetailsController', ['$scope', '$http', '$routeParams', function ($scope, $http, $routeParams) {
$scope.logs = logData;
$scope.whichItem = $routeParams.itemId;
$scope.Update = function() {
var user = {
Id: //what to put here
FirstName: //what to put here
LastName: //what to put here
Mi: //what to put here
};
//Update function here
};
}]);
又該被推杆,FirstName
等等?