ngDisable does not validate

Asked

Viewed 36 times

1

Good morning. I have been trying for a while to validate my form, disabling the Button when it is invalid. I have tried several ways, including searching here and following as it was said. But it has not worked yet.

<button type="button" class="btn btn-primary"  ng-disabled="!myForm.timeUpdateModel" data-ng-click="salvar();">Pesquisar</button>

I’ve tried using timeUpdateModel.$invalid, timeUpdateModel.$pristine, I tried to get the name of input timeUpdate.$invalid and yet none of them work. Someone can help me?

  • hello, try myForm. $invalid and put ng-required="true" in your input if you don’t have.

  • @Felipem o ng-required ja tem no input. I tried to use the way Oce said. However it still didn’t work :(

1 answer

0

I use the following syntax:

form name + component name + property

ng-disabled="!myForm.inputName.$valid"

and required must be in tbm input.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.