[英]routerLink error in child route
I have a parent component (profile) and in this component i have Basket route (profile / basket) , this is my Basket component : 我有一个父组件(配置文件),在这个组件中,我有购物篮路线(配置文件/购物篮),这是我的购物篮组件:
export class basket extends Ext implements OnDestroy{
private ShopItems_Movies : Array<{}> = [];
private ShopItems_Music : Array<{}> = [];
subscriptions : Subscription[] = [];
constructor(private _util: UtilService,private _shareService : shareService , private _Router : Router){
super();
this.subscriptions.push(_shareService.ShopItemSS$_.subscribe((items) =>{
console.log(items);
this.ShopItems_Movies = this.ext.givemelist(items ,{_type : "video"});
this.ShopItems_Music = this.ext.givemelist(items ,{_type : "music"});
}));
}
}
and my template : 和我的模板:
<a [routerLink]="[item._type == 'video' ? 'Watch' : 'Listen', {uuid: item.item.uuid}]" class="btn-block right-align">
<div class="circle item_small_like_icon2 background_standard middle inline-block" [ngStyle]="{'background-image': 'url(' + _util.storageUrl(item.item.thumbnail) + ')'}">
</div>
<p class="black-text right-align middle inline-block margin-right-5">{{item.title}}</p>
</a>
and parent route config : 和父路由配置:
@RouteConfig([
{name: 'Basket', component: basket ,path: '/basket' }
])
my problem is when i want use [routerLink]
in basket template throw this erorr : platform-browser.umd.js:962 ORIGINAL EXCEPTION: Component "basket" has no route config.
我的问题是,当我想在购物篮模板中使用
[routerLink]
,会抛出以下错误: platform-browser.umd.js:962 ORIGINAL EXCEPTION: Component "basket" has no route config.
i dont have any child in basket!!have another child component and routeLink without any problem its ok in that templates!but in this component i cant find my problem! 我没有任何孩子在篮子里!有另一个孩子组件和routeLink,在该模板中可以正常使用!但是在这个组件中,我找不到我的问题!
今天已经有一个类似的问题以这种方式起作用:
<a [routerLink]="item._type == 'video' ? ['Watch', {uuid: item.item.uuid}] : ['Listen', {uuid: item.item.uuid}]" class="btn-block right-align">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.