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

common responsibilities of a controller in an AngularJS application include:

  • Fetching the right data from the server for the current UI
  • Deciding which parts of that data to show to the user
  • Presentation logic, such as how to display elements, which parts of the UI to show, how to style them, etc.
  • User interactions, such as what happens when a user clicks something or how a text input should be validated

From

Cover of AngularJS: Up and Running

Note

AngularJS 控制器的常见责任:1,为当前界面到服务器上去提取数据。2,决定数据的哪一部分显示给用户。3,展示层的逻辑,比如怎么样显示元素,界面的哪部分要显示出来,样式是什么等等。4,用户交互,比如当户点击了什么的时候会发生什么事情,或者怎么样验证文本输入等等。