(docs) Updated docs to use 'inject()' function in code examples

This commit is contained in:
Sercan Yemen 2024-05-26 12:27:43 +03:00
parent c842dadad9
commit 34138ad5fa
6 changed files with 27 additions and 37 deletions

View File

@ -1168,10 +1168,7 @@
<textarea fuse-highlight
[lang]="'typescript'">
/**
* Constructor
*/
constructor( private _fuseAlertService: FuseAlertService ) {}
private _fuseAlertService = inject(FuseAlertService);
/**
* Dismiss the alert via the service

View File

@ -125,17 +125,10 @@
<!-- @formatter:off -->
<textarea fuse-highlight
lang="typescript">
import { FuseHighlightService } from '@fuse/components/highlight';
private _fuseHighlightService = inject(FuseHighlightService);
code = '<div> Some code to highlight </div>'
/**
* Constructor
*/
constructor(private _fuseHighlightService: FuseHighlightService)
{
const highlightedCode = this._fuseHighlightService.highlight(code, 'html');
}
highlightedCode = this._fuseHighlightService.highlight(code, 'html');
</textarea>
<!-- @formatter:on -->

View File

@ -205,10 +205,7 @@
<textarea
fuse-highlight
[lang]="'ts'">
/**
* Constructor
*/
constructor( private _fuseLoadingService: FuseLoadingService ) { }
private _fuseLoadingService = inject(FuseLoadingService);
...
@ -310,16 +307,10 @@
<textarea
fuse-highlight
[lang]="'ts'">
apiCallStatus: string = '-';
private _httpClient = inject(HttpClient);
private _fuseLoadingService = inject(FuseLoadingService);
/**
* Constructor
*/
constructor(
private _httpClient: HttpClient,
private _fuseLoadingService: FuseLoadingService
)
{ }
apiCallStatus: string = '-';
...
@ -439,12 +430,9 @@
<textarea
fuse-highlight
[lang]="'ts'">
mode: 'determinate' | 'indeterminate' = 'indeterminate';
private _fuseLoadingService = inject(FuseLoadingService);
/**
* Constructor
*/
constructor( private _fuseLoadingService: FuseLoadingService ) { }
mode: 'determinate' | 'indeterminate' = 'indeterminate';
...

View File

@ -249,10 +249,12 @@
})
export class NavigationMockApi
{
private _fuseMockApiService = inject(FuseMockApiService);
/**
* Constructor
*/
constructor(private _fuseMockApiService: FuseMockApiService)
constructor()
{
// Register Mock API handlers
this.registerHandlers();
@ -301,13 +303,15 @@
})
export class NavigationMockApi
{
private _fuseMockApiService = inject(FuseMockApiService);
private readonly _compactNavigation: any[];
private readonly _defaultNavigation: any[];
/**
* Constructor
*/
constructor(private _fuseMockApiService: FuseMockApiService)
constructor()
{
// Set the data
this._compactNavigation = compactNavigation;

View File

@ -111,10 +111,12 @@
<textarea fuse-highlight lang="typescript">
import { FuseConfigService } from '@fuse/services/config';
private _fuseConfigService = inject(FuseConfigService);
/**
* Constructor
*/
constructor(private _fuseConfigService: FuseConfigService)
constructor()
{
this._fuseConfigService.config = {layout: 'classy'};
}
@ -128,12 +130,14 @@
import { FuseConfigService } from '@fuse/services/config';
import { AppConfig } from 'app/core/config/app.config';
private _fuseConfigService = inject(FuseConfigService);
config: AppConfig;
/**
* Constructor
*/
constructor(private _fuseConfigService: FuseConfigService)
constructor()
{
this._fuseConfigService.config$
.pipe(takeUntil(this._unsubscribeAll))

View File

@ -58,10 +58,12 @@
<textarea fuse-highlight lang="typescript">
import { FuseMediaWatcherService } from '@fuse/services/config';
private _fuseMediaWatcherService = inject(FuseMediaWatcherService);
/**
* Constructor
*/
constructor(private _fuseMediaWatcherService: FuseMediaWatcherService)
constructor()
{
// Subscribe to media changes
this._fuseMediaWatcherService.onMediaChange$
@ -81,10 +83,12 @@
<textarea fuse-highlight lang="typescript">
import { FuseMediaWatcherService } from '@fuse/services/config';
private _fuseMediaWatcherService = inject(FuseMediaWatcherService);
/**
* Constructor
*/
constructor(private _fuseMediaWatcherService: FuseMediaWatcherService)
constructor()
{
// Subscribe to media changes
this._fuseMediaWatcherService.onMediaQueryChange$('(min-width: 1440px)')