import { bootstrapApplication } from '@angular/platform-browser';
import { Component, Input } from '@angular/core';
@Component({
selector: 'hello-comp',
standalone: true,
template: `<p>Hello {{ name }} from child!</p>`
})
export class HelloComponent {
@Input() name = '';
}
@Component({
selector: 'app-root',
standalone: true,
imports: [HelloComponent],
template: `
<h3>Parent Component</h3>
<hello-comp [name]="user"></hello-comp>
`
})
export class App {
user = 'Angular';
}
bootstrapApplication(App);
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular Components</title>
</head>
<body>
<app-root></app-root>
</body>
</html>