I want to disable the button if the input length is less than 3 :
<input type="text" [(ngModel)]="newListItem"> <button [disabled]="{ disabled : newListItem.length < 3 }"></button>
But this code does not work. How can I achieve my goal?
You only need to pass the expression to the disabled property, there is no need to create an object:
disabled
<button [disabled]="newListItem.length < 3"></button>
Source: https://habr.com/ru/post/1013473/More articles:Unable to read subscribe property undefined in nested calls in Angular 2 - restdocker-compose: redis connection refused between containers - pythonCSS: freeze /: focus versus click on event (mobile) touch devices - javascriptUpdating HTML5 video source URL using React - javascriptConvert CSS objects to style tag - javascriptHow to request an injection in Android Fragments and Services? - javallvm exceptions - RaiseException "?: Unknown signal" - c ++Why is $ permitted, but $$ or <$> forbidden as an operator (FS0035), and what does $ special do? - operator-overloadingWhat are the examples for @@ fetch_status values ββ-2 and -9 - sqldocker-compose: connection refused between containers, but access to the service from the host - ruby ββ| fooobar.comAll Articles