Im looking for a simple yet efficient way to achieve this in template.
The code is as follows:
studentArray = Array<boolean>;
<button class="btn btn-success"
[disabled]=""
click="generateMarksheet()">
Generate Marksheet
</button>
This button should remain disabled if every value in studentArray is false. How can I achieve this?
2
Answers
In my opinion the easiest way to achieve this is to create a method in your
ts
file that will check if all the values are false.For example :
You can then bind the method in your template :
Note : If you want to check for falsy values, you can then use
!element
instead ofelement === false
If you want to do it in the Template it could look like this: