聽不懂不是水平問題,是用心程度的問題。我第一次的時候也聽不懂,聽得犯困,就不管了。結果沒過多久就要求項目要用,馬上滾來學,全神貫注地理解,以前覺得全都聽不懂,現在全懂了。
2015-10-31
在angularjs中對于每個模塊而言,run方法只會被執行一次(在run方法中我們可以做一些初始化的工作)。對于每個模塊的方法的執行順序如下:
Here's the calling order:
app = angular.module('myModule', []);
app.config()
app.run()
directive's compile functions (if they are found in the dom)
app.controller()
directive's link functions (again if found)
Here's the calling order:
app = angular.module('myModule', []);
app.config()
app.run()
directive's compile functions (if they are found in the dom)
app.controller()
directive's link functions (again if found)
在angularjs的自定義的directive中,在A E M C四種方式中(四種方式其實都是為了達到同一個目的),推薦使用A和E,M和C因為容易造成誤解,所以不常用。
restrict中A E M C在HTML中的呈現形式:
A: <div hello></div>
E:<hello></hello>
M: <!-- directive:hello -->
C:<div class="hello"></div>
A: <div hello></div>
E:<hello></hello>
M: <!-- directive:hello -->
C:<div class="hello"></div>