如何添加' routerLink'动态?

时间:2017-10-13 14:45:30

标签: html angular angular2-routing

我正在使用Angular 4,我想附加一些来自数据库的静态html。内容中包含一些“锚标记”。这是保持routerLink属性。当我通过[innerHTML]在模板中显示时,它会删除' routeroutlet'来自锚标记的属性。如何添加&#rou; routerLink'?哪个适用于导航页面?

我的内容如下,来自数据库:

<div class="row banner-item">
          <div class="col-md-9 col-sm-9 col-xs-12">
                <a href="javascript:void(0)" [routerLink] = "['/category']"><img alt="banner-image" class="banner-image" src="assets/images/banner-img1.jpg"/></a>
          </div>
          <div class="col-md-3 col-sm-3 col-xs-12 banner-image">
                <a href="javascript:void(0)" [routerLink] = "['/category']"><img alt="banner-image" class="banner-image" src="assets/images/banner-img3.jpg"/></a>
                <a href="javascript:void(0)" [routerLink] = "['/category']"><img alt="banner-image" class="banner-image" src="assets/images/banner-img2.jpg"/></a>
          </div>
</div>

0 个答案:

没有答案