AngularJS 'controller as' and form.$valid AngularJS 'controller as' and form.$valid angularjs angularjs

AngularJS 'controller as' and form.$valid


You could do as @ons-jjss suggested but if you prefer not to inject $scope into you controller, then just change your form name as

<form name="main.contactForm" novalidate>

and it'll work like a charm.


You need to use in this way: $scope.contactForm.$valid

EDIT

To work the above syntax, $scope needs to be inhjected in controller.

app.controller('MainController', function($scope) {   //code } 


You need to use main.contactForm in form name attribute then it's solved.See this

`http://plnkr.co/edit/us8MKU3LZ7pnLV66xIrv?p=preview`