gdfgdfg gdfgdfg - 7 months ago 35
AngularJS Question

ng-class not showing correct

I have form where when is $isvalidate = true, the button has class 'disable-reg-btn', like this:

ng-class="{{reg_form.$invalid ? 'disable-reg-btn' : ''}}"

, but when I see page in the browser and when the form is invalid I see in Dev tools in Chrome this:

<button ng-class="disable-reg-btn" ng-disabled="true" ......

and the class is not added.
Where is the error ?

I am using Angular 1.5.8.
Angular is added in the footer.
The button is within the div with ng-app and ng-controller attributes.


Use the Evaluated Expression:

ng-class="{'disable-reg-btn': reg_form.$invalid}"

Check this tutorial for more info.