Home > Enterprise >  How to pass null as value for maxLength for intercomponent communication in angular
How to pass null as value for maxLength for intercomponent communication in angular

Time:12-26

<input type="text" #input *ngIf="!multiLine" [set-focus]="autoFocus" autocomplete="off" [value]="defaultValue" (input)="onChange()" [placeholder]="placeholder" [maxLength]="maxLen == true ? 250 : null"/>

this is my code but when i call it from another component and inspect maxLength is 0

<input _ngcontent-ueu-c888="" type="text" autocomplete="off" ng-reflect-set-focus="false" placeholder="Domain" maxlength="0" >

how it is displayed in inspect element

how to pass null value or remove the functionality maxlength attribute when maxLen == false

CodePudding user response:

Instead of using property binding, make use of attribute binding as below:

[attr.maxlength]="maxLen ? 250 : null"

CodePudding user response:

It is maxlength not maxLength. Try below

[maxlength]="maxLen == true ? 250 : null"
  • Related