javascript / beginner
Snippet
Standalone Components
Standalone components simplify Angular development by removing the requirement to declare components in an NgModule.
snippet.js
1
2
3
4
5
6
@Component({standalone: true,selector: 'app-info',template: '<p>System Info</p>'})export class InfoComponent {}
angular
Breakdown
1
standalone: true,
A flag that marks the component as independent from any legacy NgModule structure.
2
export class InfoComponent {}
Defines the logic for the component and exports it for use in other parts of the application.