Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit e6514e9

Browse files
committed
Use ngModel from @angular/forms for HelloWorldComponent
1 parent a0672ee commit e6514e9

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/hello-world/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ ng_module(
2424
deps = [
2525
"//src/lib",
2626
"@angular//packages/core",
27+
"@angular//packages/forms",
2728
"@rxjs",
2829
],
2930
)

src/hello-world/hello-world.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ <h1>Home</h1>
22

33
<div>Hello {{ name }}</div>
44

5-
<input type="text" [value]="name" (input)="name = $event.target.value"/>
5+
<input type="text" [(ngModel)]="name"/>

src/hello-world/hello-world.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {NgModule} from '@angular/core';
2+
import {FormsModule} from '@angular/forms';
23

34
import {HelloWorldComponent} from './hello-world.component';
45

56
@NgModule({
67
declarations: [HelloWorldComponent],
8+
imports: [FormsModule],
79
exports: [HelloWorldComponent],
810
})
911
export class HelloWorldModule {

0 commit comments

Comments
 (0)