我正在尝试动态创建带有 url 列表的链接:
<span *ngIf="item.type=='link'">
<a class="nav-link" [routerLink]="item.routerLink" skipLocationChange>{{item.label}}</a>
</span>
当我在本地主机中运行 dev 时,此解决方案运行良好,但在尝试构建库时出现以下错误:
RROR: Can't bind to 'routerLink' since it isn't a known property of 'a'. ("<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" [ERROR ->][routerLink]="navBar.routerLink" skipLocationChange><img src="{{navBar.imagePath}}" height="40px" wid")
Can't bind to 'routerLink' since it isn't a known property of 'a'. ("item':'nav-item dropdown'">
<span *ngIf="item.type=='link'">
<a class="nav-link" [ERROR ->][routerLink]="item.routerLink" skipLocationChange>{{item.label}}</a>
</span>
这是我的依赖项列表:
"@angular/animations": "~8.2.9",
"@angular/common": "~8.2.9",
"@angular/compiler": "~8.2.9",
"@angular/core": "~8.2.9",
"@angular/forms": "~8.2.9",
"@angular/platform-browser": "~8.2.9",
"@angular/platform-browser-dynamic": "~8.2.9",
"@angular/router": "~8.2.9",