9. AngularJs中数据双向绑定(必须借助表格mvvm)
2017-10-09 本文已影响0人
小草莓蹦蹦跳
<body ng-app = "app" ng-controller = "wmxController">
<!--必须使用input和ng-model,且数据要相同-->
<input type="text" ng-model="name">
<p> {{name}} </p>
<script src="angular.js"></script>
<script>
var app = angular.module('app',[]);
app.controller('wmxController',['$scope',function ($scope) {
$scope.name = "小草莓";
}])
</script>
</body>