It doesn't look like you initialized the users: UsersModel[]
array in your component so it's coming back as undefined
and you are trying to access length
property of an undefined object/array. Try the following to disable the button if users
array has NOT been initialized or the length is equal to 0:
<button type="button" [disabled]="!users || users.length === 0">Send Mass Emails</button>
Here is plunkr demonstrating this in action.
What you could also consider is initializing the user
array to an empty array in your component:
users: UsersModel[] = [];
Then you could simply do to disable/enable the button based on users length being zero/falsy:
<button type="button" [disabled]="!user.length">Send mass emails</button>
Here is a plunkr demonstrating initializing the users
array to an empty array and checking length to disable button accordingly.
Hopefully that helps!