-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(example): added examples for overriding the config service
- Loading branch information
Showing
18 changed files
with
127 additions
and
56 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
11 changes: 11 additions & 0 deletions
11
apps/angular5-example/src/app/lazy-module/custom-config.service.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 { Injectable } from '@angular/core'; | ||
import {StarRatingConfigService, StarRatingConfig} from '@angular-star-rating-lib/angular-star-rating'; | ||
|
||
@Injectable() | ||
export class CustomConfigService extends StarRatingConfigService { | ||
|
||
constructor() { | ||
super(); | ||
this.numOfStars = 10; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
apps/angular5-example/src/app/lazy-module/custom-local-config.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 { Component, OnInit } from '@angular/core'; | ||
import {CustomLocalConfigService} from './custom-local-config.service'; | ||
import {StarRatingConfigService} from '@angular-star-rating-lib/angular-star-rating'; | ||
|
||
@Component({ | ||
selector: 'custom-local-config', | ||
template: ` | ||
<h2>Custom local config in lazy module</h2> | ||
<star-rating-comp></star-rating-comp>`, | ||
providers: [ | ||
{ | ||
provide: StarRatingConfigService, useClass: CustomLocalConfigService | ||
} | ||
] | ||
}) | ||
export class CustomLocalConfigComponent implements OnInit { | ||
constructor() {} | ||
|
||
ngOnInit() {} | ||
} |
11 changes: 11 additions & 0 deletions
11
apps/angular5-example/src/app/lazy-module/custom-local-config.service.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 { Injectable } from '@angular/core'; | ||
import {StarRatingConfigService} from '@angular-star-rating-lib/angular-star-rating'; | ||
|
||
@Injectable() | ||
export class CustomLocalConfigService extends StarRatingConfigService { | ||
|
||
constructor() { | ||
super(); | ||
this.size = 'small'; | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...angular5-example/src/app/lazy-module/custom-local-config/custom-local-config.component.ts
This file was deleted.
Oops, something went wrong.
16 changes: 11 additions & 5 deletions
16
apps/angular5-example/src/app/lazy-module/lazy-module.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 |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import {StarRatingModule} from '@angular-star-rating-lib/angular-star-rating'; | ||
import {StarRatingModule, StarRatingConfigService} from '@angular-star-rating-lib/angular-star-rating'; | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { CustomConfigComponent } from './custom-config/custom-config.component'; | ||
import { CustomLocalConfigComponent } from './custom-local-config/custom-local-config.component'; | ||
import { CustomConfigComponent } from './custom-config.component'; | ||
import { CustomLocalConfigComponent } from './custom-local-config.component'; | ||
import { CustomConfigService } from './custom-config.service'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
StarRatingModule.forChild(), | ||
RouterModule.forChild([ | ||
{ | ||
{ | ||
path: '', | ||
component: CustomConfigComponent | ||
} | ||
]) | ||
], | ||
declarations: [CustomConfigComponent, CustomLocalConfigComponent] | ||
declarations: [CustomConfigComponent, CustomLocalConfigComponent], | ||
providers: [ | ||
{ | ||
provide: StarRatingConfigService, useClass: CustomConfigService | ||
} | ||
] | ||
}) | ||
export class LazyModuleModule {} |
15 changes: 15 additions & 0 deletions
15
apps/angular5-example/src/app/static-module/custom-config.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,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'custom-config', | ||
template: ` | ||
<h1>Custom static configuration in static module</h1> | ||
<star-rating-comp></star-rating-comp> | ||
<custom-local-config></custom-local-config> | ||
` | ||
}) | ||
export class CustomConfigComponent implements OnInit { | ||
constructor() {} | ||
|
||
ngOnInit() {} | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/angular5-example/src/app/static-module/custom-config.service.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,12 @@ | ||
import { Injectable } from '@angular/core'; | ||
import {StarRatingConfigService} from '@angular-star-rating-lib/angular-star-rating'; | ||
|
||
@Injectable() | ||
export class CustomConfigService extends StarRatingConfigService { | ||
|
||
constructor() { | ||
super(); | ||
this.numOfStars = 3; | ||
this.staticColor = 'positive' | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
apps/angular5-example/src/app/static-module/custom-config/custom-config.component.html
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
apps/angular5-example/src/app/static-module/custom-config/custom-config.component.ts
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
apps/angular5-example/src/app/static-module/custom-local-config.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 { Component, OnInit } from '@angular/core'; | ||
import {CustomLocalConfigService} from './custom-local-config.service'; | ||
import {StarRatingConfigService} from '@angular-star-rating-lib/angular-star-rating'; | ||
|
||
@Component({ | ||
selector: 'custom-local-config', | ||
template: ` | ||
<h2>Custom local config in static module</h2> | ||
<star-rating-comp></star-rating-comp>`, | ||
providers: [ | ||
{ | ||
provide: StarRatingConfigService, useClass: CustomLocalConfigService | ||
} | ||
] | ||
}) | ||
export class CustomLocalConfigComponent implements OnInit { | ||
constructor() {} | ||
|
||
ngOnInit() {} | ||
} |
11 changes: 11 additions & 0 deletions
11
apps/angular5-example/src/app/static-module/custom-local-config.service.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 { Injectable } from '@angular/core'; | ||
import {StarRatingConfigService} from '@angular-star-rating-lib/angular-star-rating'; | ||
|
||
@Injectable() | ||
export class CustomLocalConfigService extends StarRatingConfigService { | ||
|
||
constructor() { | ||
super(); | ||
this.size = 'small'; | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
...lar5-example/src/app/static-module/custom-local-config/custom-local-config.component.html
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...gular5-example/src/app/static-module/custom-local-config/custom-local-config.component.ts
This file was deleted.
Oops, something went wrong.
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