Cannot read property 'outlets' of null in Angular 4

前端 未结 2 846
悲&欢浪女
悲&欢浪女 2021-02-12 12:30

I have Angular 4.3.6 project where a template snippet produces this error.

Template block:

{{article?.

相关标签:
2条回答
  • 2021-02-12 12:50
     <a  [routerLink]="['/language',language.iso639_1 || 'all']" >{{language.name}}</a>
    

    I was also facing the same issue (Cannot read property 'outlets' of null ) but the above code that I have written, worked for me.

    0 讨论(0)
  • 2021-02-12 12:53

    ? in article?.id is working fine, but the RouterLink directive doesn't like getting a null passed.

    You could work around using something like:

    <a *ngIf="article" [routerLink]="['/article',article?.id]">{{article?.title}}</a>
    <a *ngIf="!article">{{article?.title}}</a>
    
    0 讨论(0)
提交回复
热议问题