如何通過單擊按鈕保存窗體中的數據? 我不明白錯誤在哪裏。 按照計劃,當你從存儲在變量「大師」從窗體保存數據按鈕點擊
例如現場上的數據點擊我使用本教程:http://www.w3schools.com/angular/angular_forms.asp所有的
<!DOCTYPE html>
<html lang="en">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body> <div ng-app="myApp" ng-controller="formCtrl">
<form novalidate>
First Name:<br>
<input type="text" ng-model="firstName"><br>
<button ng-click="copyData()">Click Me!</button>
</form>
<p>form = {{user}}</p>
<p>master = {{master}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {
$scope.master = {uder.firstName};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);
};
$scope.reset();
$scope.copyData=function(){
$scope.master1=angular.copy($scope.mas);
$scope.copyData();
}
});
</script>
</body>
</html>
究竟你想在這裏做什麼? – Sravan
通過點擊「Click me!」保存表單中的數據 – Dmitry
要保存哪些數據以及在哪裏? – Sravan