您的位置:首页技术文章
文章详情页

angular.js - angularjs 中 input 绑定ng-model 无效

【字号: 日期:2024-09-13 16:21:22浏览:66作者:猪猪

问题描述

input双向数据绑定没有效果 绑定ng-model后 监听事件都没有触发,大神们 求助啊 求助啊,创建成对象的方式也试过了都不行。

<p class='form-group'>

<label class='col-sm-1 label-color'>作业内容</label> <p class='col-sm-10'><span> <input name=’workContent’ ng-model=’usernametest’ ng-bind=’{{usernametest}}’></span> </p></p>

js.

$scope.usernametest = ’info’;$scope.$watch(’usernametest’, function() { console.log($scope.usernametest);})

问题解答

回答1:

实测代码是可以运行的。angular.js - angularjs 中 input 绑定ng-model 无效

你要不把完整代码发上来看看?

相关文章: