<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>angular.js</title>
</head>
<body>
<div ng-app = "" ng-controller="mycontrol">
<h3>firstName:</h3>
<input type = "text" ng-model="user.firstname">
<h3>lastName:</h3>
<input type = "text" ng-model = "user.lastname">
<button ng-click="reset()">reset</button>
<p>form: {{user}}</p>
<p>master: {{master}}</p>
</div>
<script>
function mycontrol($scope){
$scope.master = {
firstname: "zhao",
lastname: "yuxa"
};
$scope.reset = function () {
$scope.user = angular.copy($scope.master);
}
/*$scope.reset();*/
}
</script>
<script src = "../angular.js/angular.min.js"></script>
</body>
</html>为什么在<script> 中,我去掉加注释的那一部分,刚开始浏览器中表格里面就没有内容呢??
是执行顺序的事儿吗?求解答
更好的自己lin
woshiajuana
随时随地看视频慕课网APP