简体   繁体   English

子路由中的routerLink错误

[英]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.

相关问题 单击 routerLink 到子路由角度 2 后,视图不会更改 - View doesn't change after clicking on routerLink to child route angular 2 用参数无法路由的routerLink - routerLink to route with parameters not working Angular 2 - 应该是routerLink =“theRoute”还是[routerLink] =“[&#39;the route&#39;]”? - Angular 2 - should it be routerLink=“theRoute” or [routerLink]=“['the route']”? 无法使用router.navigate方法或routerlink ::导航到子路由:错误:无法匹配任何路由。 网址段:“ child2” - Cannot navigate to child routes using router.navigate method or routerlink :: Error : Cannot match any routes. URL Segment: 'child2' Angular routerLink 附加路由而不是替换 - Angular routerLink appends route instead of replacing 启用使用 routerlink 作为子 vue 3 单击父标签 - enable clickling on parent tag with routerlink as child vue 3 Angular 2在子组件中为[routerLink]模板化的正确方法 - Angular 2 proper way to template a [routerLink] in a child component Angular 2和SystemJS子路由访问错误 - Angular 2 and SystemJS child route access error 有没有一种方法可以通过routerLink / router.navigate附加查询/路由参数? - Is there a way to append query/route parameters with routerLink/router.navigate? 我怎样才能使带有 routerLink 的标签强制重新加载该路由? - how can I make an a tag with a routerLink force a reload of that route?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM