0

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.

Tester
  • 1
  • 2
    Possible duplicate of [Can I append a string with the ng-include URL?](https://stackoverflow.com/questions/20755200/can-i-append-a-string-with-the-ng-include-url) – Govind Samrow Aug 30 '17 at 06:28

1 Answers1

1

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

<div data-ng-include="'app/templates/' + {{ templateUrl }} + '.html'"></div>
Suren Srapyan
  • 66,568
  • 14
  • 114
  • 112