-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: signal based configuration (#1593)
Signal-based configuration - Reducing boilerplate code - Use of new feature: Angular Signal - Usage of rxjs hidden behind `configSignal(...)` - Still works with rxjs `config$ = toObservable(this.configSignal)`; ## Proposed change ```diff export class MyComponent implements - OnChanges, DynamicConfigurable<MyConfig> { + DynamicConfigurableWithSignal<MyConfig> { + private readonly configService = inject(ConfigurationBaseService, { optional: true }); - @input() - public config: Partial<MyConfig> | undefined; + public config = input<Partial<MyConfig>>(); - @ConfigObserver() - private dynamicConfig$: ConfigurationObserver<MyConfig>; - public config$: Observable<MyConfig>; + @ConfigSignal() + public readonly configSignal = configSignal( + this.config, + MY_CONFIG_CONFIG_ID, + MY_CONFIG_DEFAULT_CONFIG, + this.configService + ); - constructor(@optional() configService: ConfigurationBaseService) { - this.dynamicConfig$ = new ConfigurationObserver<MyConfig>( - MY_CONFIG_CONFIG_ID, - MY_CONFIG_DEFAULT_CONFIG, - configService - ); - this.config$ = this.dynamicConfig$.asObservable(); - } - public ngOnChanges(changes: SimpleChanges) { - if (changes.config) { - this.dynamicConfig$.next(this.config); - } - } } ```
- Loading branch information
Showing
38 changed files
with
705 additions
and
126 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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/schematics/collection-schema.json", | ||
"schematics": { | ||
"migration-v10_3": { | ||
"version": "10.3.0-alpha.0", | ||
"description": "Updates of @o3r/configuration to v10.3.*", | ||
"factory": "./schematics/ng-update/v10-3/index#updateV10_3" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.