Conditional ng-include in angularjs

前端 未结 5 2238
囚心锁ツ
囚心锁ツ 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:34

    You could also do

    In your controller

    $scope.getInclude = function(){
        if(x){
            return "partial.html";
        }
        return "";
    }
    

提交回复
热议问题