Angular JS - How to handle duplicated HTML code like headers/footers?

前端 未结 4 836
Happy的楠姐
Happy的楠姐 2021-02-01 06:14

I just read the introduction to Angular JS but I didn\'t see anything about a way to code up your HTML header code and footer code just once and have it included in all of your

4条回答
  •  情歌与酒
    2021-02-01 06:46

    If you are creating a single-page web application (say, with bookmarkable views/pages using $routeProvider), you can put your header and footer directly into index.html (or use ng-include) and then use ng-view to switch between views/pages:

    
    
       
    
    
       ... header here, or use ng-include ...
       
    ... footer here, or use ng-include ...

提交回复
热议问题