0
我有一个模板,我需要动态显示模板的路径。如何在角js中的模板中执行concatination
<div data-ng-include="'app/templates/'templateUrl'.html'"></div>
$scope.templateUrl = "text";
但该链接不会映射为:
app/templates/text.html
任何一个可以请帮助我。谢谢。
我有一个模板,我需要动态显示模板的路径。如何在角js中的模板中执行concatination
<div data-ng-include="'app/templates/'templateUrl'.html'"></div>
$scope.templateUrl = "text";
但该链接不会映射为:
app/templates/text.html
任何一个可以请帮助我。谢谢。
试试这种方法。通过连接部件来制作一个字符串。
<div data-ng-include="'app/templates/' + {{ templateUrl }} + '.html'"></div>
嗨Suren,它不适合我的情况。 – Tester
可能重复的[我可以追加一个字符串与ng-include URL吗?](https://stackoverflow.com/questions/20755200/can-i-append-a-string-with-the- ng-include-url) –