mykolaharmash
mykolaharmash

Reputation: 89

AngularJS - Form validation, how to scroll to first invalid input

I want to scroll document to first invalid input in the form on button click (without using jquery of course). What a proper (angular-way) approach for this situation? Thanks.

Upvotes: 2

Views: 2350

Answers (1)

DrogoNevets
DrogoNevets

Reputation: 1575

include jquery so you get the full selector ability and in your controller do

angular.element(".ng-invalid:first") ...

Upvotes: 2

Related Questions