O'Reilly logo
  • hao wang thinks this is interesting:

Anything that the user needs to see, or the HTML needs to use, needs to be defined on this. Anything that the HTML does not directly access should not be put on this, but should rather be saved as local variables in the controller’s scope, similar to goodbyeMsg.

From

Cover of AngularJS: Up and Running

Note

用户要看到的东西,或者 HTML 需要用到的,都 要在 this 这个下面去定义。任何 HTML 不能直接访问的东西,不要放到 this 下面,可以放到控制器下面的本地变量里。