大家好我正在做一个自定义指令......它显然工作正常,但图像没有显示......我让你看到我的指令
.directive('rhBanner', function () {
return {
restrict: 'E',
replace: true,
transclude: true,
templateUrl: '/partial_views/directives/templates/banner.html',
scope: {
rhTitle: '@title',
rhImgSrc: '@img'
},
controller: function () { }
};
})
这里是模板:
<div class="tg-banner tg-haslayout parallax-window" data-appear-top-offset="600" data-parallax="scroll" data-image-src="{{ rhImgSrc }}">
<h1>{{ rhTitle }}</h1>
</div>
这里生成的HTML(我认为HTML是正确的):
<div class="tg-banner tg-haslayout parallax-window ng-isolate-scope" data-appear-top-offset="600" data-parallax="scroll" data-image-src="images/page-banner-img/img-01.jpg" title="Chi Siamo" img="images/page-banner-img/img-01.jpg">
<h1 class="ng-binding">Chi Siamo</h1>
</div>
如果我直接在页面中复制并浏览该HTML,一切正常,因此img-src路径正确! 但也许我在某处错了。正如你所看到的那样,标题在H1元素和DIV元素中被复制......是奇怪的,不是吗?
谢谢