-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(angular): call ngOnChanges after mount
- Loading branch information
1 parent
a76df0b
commit 95aa120
Showing
3 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
system-tests/project-fixtures/angular/src/app/components/lifecycle.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, Input, OnInit, OnChanges, SimpleChanges } from '@angular/core' | ||
|
||
@Component({ | ||
selector: 'app-lifecycle', | ||
template: `<p>Hi {{ name }}. ngOnInit fired: {{ ngOnInitFired }} and ngOnChanges fired: {{ ngOnChangesFired }} and conditionalName: {{ conditionalName }}</p>` | ||
}) | ||
export class LifecycleComponent implements OnInit, OnChanges { | ||
@Input() name = '' | ||
ngOnInitFired = false | ||
ngOnChangesFired = false | ||
conditionalName = false | ||
|
||
ngOnInit(): void { | ||
this.ngOnInitFired = true | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
this.ngOnChangesFired = true; | ||
if (changes['name'].currentValue === 'CONDITIONAL NAME') { | ||
this.conditionalName = true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters