Staying Sharp with Angular.js part 1

來源:互聯網
上載者:User

標籤:fetch   library   分享   image   http   定義   r.js   ice   har   

根據類別建立檔案夾,並把js檔案放在相應的檔案夾下面:

 

靜態html檔案裡面很多重複的部分

在這個兩個html檔案裡面,only unique的部分就是特定的一些div

把unique的部分放在own temple file裡面

把templates 放在自己的檔案夾裡面:

把ng-app載入 main index file裡面

如果我們載入頁面#notes,那麼相應note div應該出現,那麼我們如何做到這一點?

定義一個routes.js 來fetch and load notes/index.html

用router 有四個步驟:

step 1: using ngView

step 2 loading ngRoute library

step 3 

 bad practice

step 4

不需要declear routerProvider each time

我們需要設定預設值,這樣沒有#後面部分也能顯示預設的部分

 

 

 

 

otherwise redirect to the root

 

Staying Sharp with Angular.js part 1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.