我有一个plnkr,故事很长,但归结为我需要能够使用来自 templateCache 的图像。我尝试像这样使用ng-src来做到这一点......
$templateCache.put('img/help/copy_icon', '://www.drupal.org/files/issues/sample_7.png')
...
template: '<img ng-src="{{url}}">'
然而,这不起作用,我得到......
copy_icon':1 获取https://run.plnkr.co/ZyTH7LFhPLhdQpCI/'img/help/copy_icon ' 400 ()
所以它不是试图从 templateCache 中获取它。有没有办法做到这一点?
更新
我试过了 ...
$http.get('://www.drupal.org/files/issues/sample_7.png').success(function (t) {
$templateCache.put('img/help/copy_icon', t);
});
但这也不起作用