Chapter2: Angular.js

This section contain the following items:

  1) Introduction
  2) Life cycle

1.Introduction

2.Life Cycle

  1) run, config , controller的執行順序:
    1.app.config()
    2.app.run()
    3.directive's compile functions (if they are found in the dom)
    4.app.controller()
    5.directive's link functions (again if found)

    example:http://jsfiddle.net/ysq3m/
    reference:http://iambigd.blogspot.tw/2014/08/angularjs-angular.html
  2) 使用經驗:
     1.將需要驗證使用者身份的部分放到run中
     2.將頁面中與使用者互動的部分放在controller
     3.將共同的功能($http)放到service

Last updated

Was this helpful?