84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
点击确定按钮之后,再将编辑的数据展示在页面上,用angular该怎么实现`your name: <input type="text" ng-model="yourname"/> <button>确定</button> Hello {{yourname}}!`
认证高级PHP讲师
Then your code should look like this:
var model = angular.module('demo', []); model.controller('DemoCtrl', function($scope){ $scope.user = {}; $scope.username = ''; $scope.confirm = function(){ $scope.user.username = $scope.username; $scope.username = ''; }; });
your name: <input type="text" ng-model="username"/> <button ng-click="confirm()">确定</button> Hello {{ user.username }}!
You can change ng-model to namehello{{confirmNmae}}Achieve value assignment in the controller
Then your code should look like this:
You can change ng-model to name
hello{{confirmNmae}}
Achieve value assignment in the controller