扫码关注官方订阅号
点击确定按钮之后,再将编辑的数据展示在页面上,用angular该怎么实现`your name: <input type="text" ng-model="yourname"/> <button>确定</button> Hello {{yourname}}!`
认证高级PHP讲师
那你的代码应该是这个样子喽:
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 }}!
可以将ng-model改为namehello{{confirmNmae}}在controller中实现赋值
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
那你的代码应该是这个样子喽:
可以将ng-model改为name
hello{{confirmNmae}}
在controller中实现赋值