-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
31 additions
and
26 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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<a routerLink="normal">normal</a> | <a routerLink="lazy">lazy</a> | ||
<hr /> | ||
|
||
<router-outlet></router-outlet> |
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
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
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import { Component, OnInit, SimpleChanges } from '@angular/core'; | ||
import { Title } from '@angular/platform-browser'; | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'lazy-child-comp', | ||
template: 'lazy child component works', | ||
}) | ||
export class LazyChildComponent { | ||
constructor(public titleService: Title) {} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
console.log({ changes }); | ||
this.titleService.setTitle('child'); | ||
constructor() { | ||
console.log('===> lazy-child: constructor') | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
import { Title } from '@angular/platform-browser'; | ||
import { HttpClient } from '@angular/common/http'; | ||
|
||
@Component({ | ||
selector: 'lazy-comp', | ||
template: '<lazy-child-comp></lazy-child-comp>', | ||
template: '<lazy-child-comp *ngIf="ready"></lazy-child-comp>', | ||
}) | ||
export class LazyComponent { | ||
constructor(public titleService: Title) { | ||
this.titleService.setTitle('lazy#1'); | ||
ready=false | ||
constructor(private httpClient:HttpClient) { | ||
this.httpClient.get('https://jsonplaceholder.typicode.com/todos/1').subscribe(()=>{ | ||
this.ready=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { Component, SimpleChanges } from '@angular/core'; | ||
import { Title } from '@angular/platform-browser'; | ||
import { Component } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
|
||
@Component({ | ||
selector: 'normal-child-comp', | ||
template: 'normal child component works', | ||
}) | ||
export class NormalChildComponent { | ||
constructor(public titleService: Title) {} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
console.log({ changes }); | ||
this.titleService.setTitle('child'); | ||
constructor() { | ||
console.log('===> normal-child: constructor') | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
import { Title } from '@angular/platform-browser'; | ||
import { HttpClient } from '@angular/common/http'; | ||
|
||
@Component({ | ||
selector: 'normal-comp', | ||
template: '<normal-child-comp></normal-child-comp>', | ||
template: '<normal-child-comp *ngIf="ready"></normal-child-comp>', | ||
}) | ||
export class NormalComponent { | ||
constructor(public titleService: Title) { | ||
this.titleService.setTitle('normal#1'); | ||
ready=false | ||
constructor(private httpClient:HttpClient) { | ||
this.httpClient.get('https://jsonplaceholder.typicode.com/todos/1').subscribe(()=>{ | ||
this.ready=true | ||
}) | ||
} | ||
} |