Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
@angular/forms
Advanced tools
The @angular/forms package is a part of the Angular framework that provides tools for creating and managing forms in Angular applications. It offers two approaches: Reactive Forms and Template-driven Forms, which allow developers to handle user input and form validation in a robust and scalable way.
Reactive Forms
Reactive Forms provide a model-driven approach to handling form inputs whose values change over time. This feature allows for more flexible, scalable, and testable forms.
import { ReactiveFormsModule } from '@angular/forms';
@NgModule({
imports: [
// other imports ...
ReactiveFormsModule
],
})
export class AppModule { }
Template-driven Forms
Template-driven Forms are useful for adding simple forms to your app with minimal setup. They are less flexible than Reactive Forms but can be easier to use for basic scenarios.
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
// other imports ...
FormsModule
],
})
export class AppModule { }
Form Validation
The package provides built-in validators as well as the ability to create custom validators, making it easy to implement complex validation logic for form fields.
import { FormControl } from '@angular/forms';
let email = new FormControl('', [Validators.required, Validators.email]);
Form Groups
Form Groups are used to group together multiple form controls into one object, allowing for easier management of form data and validation.
import { FormGroup, FormControl } from '@angular/forms';
let userForm = new FormGroup({
firstName: new FormControl(),
lastName: new FormControl(),
age: new FormControl()
});
React Hook Form is a library for React that enables the management of forms with minimal re-renders. It is similar to @angular/forms in providing form validation and form state management, but it is designed specifically for React and uses hooks.
Formik is another popular form library for React. It simplifies the process of building, validating, and handling forms. It is comparable to @angular/forms in its functionality but is tailored to the React ecosystem.
Redux Form leverages Redux for form state management in React applications. It is similar to @angular/forms in that it handles form state and validation, but it integrates tightly with Redux for state management.
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT
19.1.3 (2025-01-22)
| Commit | Type | Description | | -- | -- | -- | | ecfb74d287 | fix | handle :host-context with comma-separated child selector (#59276) |
| Commit | Type | Description | | -- | -- | -- | | 53160e504d | fix | extract parenthesized dependencies during HMR (#59644) | | 39690969af | fix | handle conditional expressions when extracting dependencies (#59637) | | 78af7a5059 | fix | handle new expressions when extracting dependencies (#59637) |
| Commit | Type | Description | | -- | -- | -- | | 408af24ff3 | fix | capture self-referencing component during HMR (#59644) | | d7575c201c | fix | replace metadata in place during HMR (#59644) | | 26f6d4c485 | fix | skip component ID collision warning during SSR (#59625) |
| Commit | Type | Description | | -- | -- | -- | | a62c84bc18 | fix | avoid applying the same replacements twice when cleaning up unused imports (#59656) |
| Commit | Type | Description | | -- | -- | -- | | b2b3816cb1 | fix | clear renderer cache during HMR when using async animations (#59644) |
<!-- CHANGELOG SPLIT MARKER --><a name="19.1.2"></a>
FAQs
Angular - directives and services for creating forms
The npm package @angular/forms receives a total of 2,470,160 weekly downloads. As such, @angular/forms popularity was classified as popular.
We found that @angular/forms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.