Different ng-include's on the same page: how to send different variables to each?

前端 未结 15 1339
北海茫月
北海茫月 2020-12-04 12:17

I\'ve got a page in my AngularJS app in which I would like to include the same html partial, but with different variables. If I do this in my main html:

15条回答
  •  攒了一身酷
    2020-12-04 13:05

    consider you have variable foo inside your partial,

    then you will pass foo like this:

    
    

    for more browser compatibility you can pass it like this:

    you can also Use onInclude="foo='bar'" instead of onLoad

    plnkr.co/edit/GHRNyAMBKLvgtf3NFSRu?p=info

提交回复
热议问题