-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add Input Property to Component
Tyler Ruff edited this page Jun 14, 2022
·
1 revision
In Angular, you can dynamically or statically pass data to components using a "Input" property. This allows you to pass data or a variable to the component.
- Add import to component.ts:
import { ... Input ... } from '@angular/core';
- Add the input parameter, right after the class declaration:
@Input() page = '/default';
- Finally, you can use the input within the component.html file:
<app-component [page]="id"></app-component>
Join the Blazed Development Group today to get involved in open source collaborative projects.
Discover our FREE learning resources, the Blazed University, Web Development School, and Blazed City.