Search code examples
javascriptangularjsangular-templateangularjs-ng-include

ng-include with mixed value hard-coded and variables from the scope


I want the ng-include to have value like that \'customer\'+{{action}}+\'.html\'

.directive('tabContent',function(){
return {
    restrict: 'E',
    template:'<div ng-if="view==\'customer\'+{{action}}+\'.html'\" ng-include="\'{{action}}.html\'"></div>',
    link: function(scope, elem, attrs) {
        scope.action = attrs.action;
    }
}

})

How can I combine in the value ng-include hard-coded values and scope values.
Thanks,
        Omer


Solution

  • Your ng-include should correct like below.

    ng-include="action + \'.html\'"></div>',