AngularJs can't access form object in controller ($scope)

后端 未结 7 1396
臣服心动
臣服心动 2020-12-07 12:25

I am using bootstrap-ui more specifically modal windows. And I have a form in a modal, what I want is to instantiate form validation object. So basically I am doing this:

相关标签:
7条回答
  • 2020-12-07 12:59

    No need for the ng-init trickery, because the issue is that $scope.form is not set when the controller code is run. Remove the form = {} initialization and get access to the form using a watch:

    $scope.$watch('form', function(form) {
      ...
    });
    
    0 讨论(0)
提交回复
热议问题