How to call $scope.$apply() using “controller as” syntax

前端 未结 1 1198
梦谈多话
梦谈多话 2020-12-18 19:52

I am trying to limit my use of $scope in my controllers as much as possible and replace it with the Controller as syntax.

My current proble

相关标签:
1条回答
  • 2020-12-18 20:49

    To answer the question at hand here, you can use $scope() methods in a controller when using the controller-as syntax, as long as you pass $scope as a parameter to the function. However, one of the main benefits of using the controller-as syntax is not using $scope, which creates a quandary.

    As was discussed in the comments, a new question will be formulated by the poster to review the specific code requiring $scope in the first place, with some recommendations for re-structuring if possible.

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