dynamic routing AngularJS

后端 未结 1 1672
名媛妹妹
名媛妹妹 2021-01-24 18:42

I am trying to bind a route property to the src for ng-include:

config.js

$routeProvider.when(\'/services\', {         


        
相关标签:
1条回答
  • 2021-01-24 19:21

    Oh your are just making a very small mistake please change your code to below

    <div ng-include="page"  class="container"></div>
    

    More Detailed Answer : When you use ng-include directive a watch is put on srcExp which is value of attr.ngInclude || attr.src so if you do {{page}} then you will be watching on the value of page not on page property so you have to put "page" without interpolated value so that it can watch directly on page instead of page string value

    0 讨论(0)
提交回复
热议问题