Difference between $scope and this in controller context?

This question already has an answer here:

  • 'this' vs $scope in AngularJS controllers 7 answers

  • The difference is the scope of the object you're interacting with. $scope is an object injected into your controller. Your controller is an object representative of a given piece of your angular application.

    Earlier on in Angular, controllers weren't objects. They are now.

    You should be fine going either way (if you're concerned about which is correct), but controller as is a little more concise.

    链接地址: http://www.djcxy.com/p/77798.html

    上一篇: AngularJS:迭代对象时代码不工作

    下一篇: 控制器上下文中$ scope与this之间的区别?