@{
Layout = null;
}
<!DOCTYPE html>
<html ng-app="my_app">
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module("my_app", []);
app.controller('my_controller', function ($scope) {
$scope.student = { name: '张三', address: '浙江' };
$scope.test = function () {
alert($scope.student.name);
}
});
</script>
</head>
<body ng-controller="my_controller">
<table>
<tr>
<td><input type="text" ng-model="student.name" /></td>
<td><input type="text" ng-model="student.address" /></td>
<td><input type="button" ng-click="test();" value="test" /></td>
</tr>
</table>
</body>
</html>
angularjs 双向绑定
最新推荐文章于 2018-12-18 09:33:37 发布