【发布时间】:2014-11-18 02:50:34
【问题描述】:
我有一个带有在链接器函数中编译的 html 模板的 angularjs 指令
var htmlTemplate = '<img ng-src="~/img/logos/{{account.Logo}}" width="45" height="35" />'
var linker = function (scope, element) {
element.html(htmlTemplate).show();
$compile(element.contents())(scope);
};
但该指令并未评估 img src 中的“~”符号来解析图像路径。
有什么想法吗?
【问题讨论】:
标签: javascript angularjs angularjs-directive angularjs-scope angularjs-ng-repeat