ng-model no longer updates after typing into text input

前端 未结 1 1591
北荒
北荒 2020-12-13 18:35

I am new to AngularJS and I am having a problem that I am having trouble solving, there was a similar question on stackoverflow but it didn\'t seem to help me out. I basical

相关标签:
1条回答
  • 2020-12-13 19:20

    your link requires a login.

    if i have to guess about your problem, it may be related to angular scoping issue. try changing your ng-model binding to an object property instead. so in your html, instead of:

    <input type="text" id="form_course_name" ng-model="edit_course_name">
    

    do this

    <input type="text" id="form_course_name" ng-model="course.edit_course_name">
    

    and in your javascript, on the ajax callback, change it to:

    $scope.course = {};  //only do this if $scope.course has not already been declared
    $scope.course.edit_course_name = thecourse.course_name;
    

    for more info on this issue, see: https://github.com/angular/angular.js/wiki/Understanding-Scopes

    0 讨论(0)
提交回复
热议问题