Home  >  Q&A  >  body text

angular.js - Input binding to ng-model in angularjs is invalid

Input two-way data binding has no effect. After binding ng-model, the monitoring events are not triggered. Masters, please help me. Please help me.
I have also tried the method of creating an object, but it doesn't work.

<p class="form-group">

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

js.


$scope.usernametest = 'info';
$scope.$watch('usernametest', function() {
    console.log($scope.usernametest);
})
曾经蜡笔没有小新曾经蜡笔没有小新2668 days ago732

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-06-05 11:11:51

    The tested code can be run.

    Why don’t you post the complete code for a look?

    reply
    0
  • Cancelreply