Tester
Tester

Reputation: 1

How to perform concatination in a template in angular js

I have a template which I need to show the path of a template dynamically.

<div data-ng-include="'app/templates/'templateUrl'.html'"></div>

$scope.templateUrl = "text";

But the link is not mapped as :

app/templates/text.html

Can any one please help me. Thanks.

Upvotes: 0

Views: 33

Answers (1)

Suren Srapyan
Suren Srapyan

Reputation: 68665

Try this way. Make a string by concatenating the parts.

<div data-ng-include="'app/templates/' + {{ templateUrl }} + '.html'"></div>

Upvotes: 1

Related Questions