1.

https://zhangchen915.gitbooks.io/angular2-training/content/content/Modules/shared-di-tree.html

根module跟另一module的元件都有用到SharedModule的provider的服務

如果要讓service不另創造實例要forRoot 在根module

這樣兩個元件點++都會是同一個實例

 

arrow
arrow
    全站熱搜

    學習程式 發表在 痞客邦 留言(0) 人氣()