Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Ismaestro/ngx-scroll-to-first-invalid

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngx-scroll-to-first-invalid

Angular directive to scroll to first invalid input inside a form.

LIVE DEMO
Demo example
Report bug · Request feature

Table of contents

Usage

npm i @ismaestro/ngx-scroll-to-first-invalid --save-dev

1. Import the directive in your component:

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  standalone: true,
  imports: [NgxScrollToFirstInvalidDirective, ...],
  changeDetection: ChangeDetectionStrategy.OnPush,
})

2. Use the directive inside a form:

<form [formGroup]="testForm" ngxScrollToFirstInvalid>
  <input id="test-input1" type="text" formControlName="someText1" />
  <button (click)="saveForm()"></button>
</form>

Here you have an example of a form using ngx-scroll-to-first-invalid. DEMO

It also works with nested forms, and recently added support for Angular Ionic.

Bugs and feature requests

Have a bug or a feature request? Please first read the issue guidelines and search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.

Creators

Ismael Ramos

Copyright and license

Code released under the MIT License.

Enjoy 🤘

About

Directive to scroll to first invalid form control inside an Angular form on submit

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.