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

前端 未结 4 837
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:41

    The official way to do it is to use ngInclude directive, which "fetches, compiles and includes an external HTML fragment".

    
    
    
      
    
    
    
      
    ...

    With this you can reuse the same header.url and footer.url in all your pages.

提交回复
热议问题