angularjs onclick disable button click 1

angularjs onclick disable button click

try like this



@Input() isDisabled: boolean = false;
@Output() btnClick = new EventEmitter();
Use Output and By default the button click event won't work if button is disabled. take advantage of it

 submit 

Here is what the above code is Doing:
1. We are creating a custom button component with the selector my-button.
2. We are using the @Input decorator to accept a boolean value isDisabled.
3. We are using the @Output decorator to emit a custom event btnClick.
4. We are using the disabled attribute to disable the button.
5. We are using the (click) event to emit the btnClick event.
6. We are using the tag to render the content inside the custom button component.

Similar Posts