Parser Error: Got interpolation ({{}}) where expression was expected

前端 未结 6 2230
夕颜
夕颜 2020-12-06 16:11

I\'m using ng-bootstrap as a substitute for ui-bootstrap in angular2.

My html is as follows:

相关标签:
6条回答
  • 2020-12-06 16:47

    Usually this error occurs when we are trying to implement both Interpolation and Property data binding on the same html property.

    Example:

    Wrong implementation

    [disabled]= {{isDisabled}}
    

    Correct implementation

    disabled= {{isDisabled}}
    

    Note: remove the square bracket from the html element property

    0 讨论(0)
  • 2020-12-06 16:48

    Use this

      <button class="btn btn-primary" title="Edit" (click)="showEditModal(record.id)"><i class="fa fa-edit"></i></button>
    
    0 讨论(0)
  • 2020-12-06 16:57

    If you want pass only $index value

    [attr.aria-labelledby]=" ' ' + $index"
    
    0 讨论(0)
  • 2020-12-06 17:02

    You can't use interpolation inside standard property binding. There should be an expression.

    Seems it should be:

    [attr.aria-labelledby]="'desiredSkill' + $index"
    

    or

    attr.aria-labelledby="desiredSkill{{$index}}"
    
    0 讨论(0)
  • 2020-12-06 17:04

    I think you forgot to declare index of ngFor

    *ngFor="let item of ['Elastic Search','Database Theory','CVS'];let $index=index" ...
    

    also use,

    [attr.aria-labelledby]="desiredSkill{{$index}}"
    
    0 讨论(0)
  • 2020-12-06 17:05

    In link tags use like this

    Use this

    <a  class="custom-badge status-blue" [routerLink]="'/hospital/doctorleave/'+item.Id]">Manage Leave</a> 
    

    Instead of

    <a  class="custom-badge status-blue" [routerLink]="'/hospital/doctorleave/{{item.Id}}']">Manage Leave</a> 
    
    0 讨论(0)
提交回复
热议问题