-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sitecore-jss-angular] Missing ngModuleRef in lazy loaded components (#…
…1743) * Fixed missing ngModuleRef * Covered by unit tests * Updated CHANGELOG --------- Co-authored-by: Patrick Oswald (OSP) <gast.patrick.oswald@suva.ch>
- Loading branch information
1 parent
d3a491e
commit af0e5cf
Showing
9 changed files
with
146 additions
and
6 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
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
20 changes: 20 additions & 0 deletions
20
packages/sitecore-jss-angular/src/test-data/lazy-component.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,20 @@ | ||
import { ComponentRendering } from '@sitecore-jss/sitecore-jss/layout'; | ||
import { MockService } from './mock.service'; | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'lazy-component', | ||
template: ` | ||
{{ rendering?.fields?.linkText?.value }} | ||
{{ getNum() }} | ||
`, | ||
}) | ||
export class LazyComponent { | ||
@Input() rendering: ComponentRendering; | ||
|
||
constructor(private mockService: MockService) {} | ||
|
||
getNum() { | ||
return this.mockService.get(10); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/sitecore-jss-angular/src/test-data/lazy-loading.module.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,11 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { MockService } from './mock.service'; | ||
import { LazyComponent } from './lazy-component.component'; | ||
import { JssModule } from '../lib.module'; | ||
|
||
@NgModule({ | ||
imports: [JssModule.forChild(LazyComponent)], | ||
declarations: [LazyComponent], | ||
providers: [MockService], | ||
}) | ||
export class AngularLazyLoadingModule {} |
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,8 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable() | ||
export class MockService { | ||
get(num: number): number { | ||
return num; | ||
} | ||
} |
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