Conditional ng-include in angularjs

前端 未结 5 2275
囚心锁ツ
囚心锁ツ 2020-12-04 10:48

How can I do the ng-include conditionally in angularJS?

For example I only want to include something if, the variable x is set to true.

5条回答
  •  不知归路
    2020-12-04 11:41

    I encountered a similar issue and may be this finding can help someone. I have to display different partials on click of link but ng-if and ng-switch both were not working in this scenario(Below code was not working).

    
    
    
    
    

    So what I did is, instead of using ng-if, On click of link just update the value of partialArticleUrl (which is a model in controller) and declare below code on html.

            

提交回复
热议问题