Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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.0.0-rc.2 (2024-11-14)
| Commit | Type | Description | | -- | -- | -- | | 560282aa9b | fix | control flow nodes with root at the end projected incorrectly (#58607) |
| Commit | Type | Description | | -- | -- | -- | | 791ee323dc | fix | correct extraction of generics from type aliases (#58548) | | 9bbb01c85e | fix | report individual diagnostics for unused imports (#58589) |
| Commit | Type | Description | | -- | -- | -- | | 71ee81af2c | fix | clean up event contract once hydration is done (#58174) | | 5fe57d4fbb | fix | fixes issues with control flow and incremental hydration (#58644) | | 51933ef5a6 | fix | prevent errors on contract cleanup (#58614) |
| Commit | Type | Description | | -- | -- | -- | | b84ed2b628 | fix | include the output migration in the defaults of the signal migration (#58635) | | e26797b38e | fix | replace removed NgModules in tests with their exports (#58627) |
<!-- CHANGELOG SPLIT MARKER --><a name="18.2.12"></a>
FAQs
Angular - directives and services for creating forms
The npm package @angular/forms receives a total of 3,026,377 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.