Parts of page as subviews in Angular

后端 未结 5 1594
傲寒
傲寒 2020-12-24 03:02

I have the following problem to solve:

\"enter

From within local menu (menu on

5条回答
  •  死守一世寂寞
    2020-12-24 03:28

    Somewhat similar to kseb's answer, if you prefer to use out-of-the-box Angular, you can use ng-include for this. By attaching a controller you can change what you want shown there as easily as you can for any other "real" view.

    If you create a menu.html file in your /views:

  • {{menu.name}}
  • You can include it in your index.html like this:

    
        

      That does the trick and is fully valid, works in all browsers. The controller can be just like any other controller you might use.

    提交回复
    热议问题