
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
@lucca-front/ng
Advanced tools
Add title
properties in your routes config:
const routes: Routes = [
{
path: '',
data: {
title: 'Parent title',
},
children: [
{
path: ':requestId',
data: {
title: 'Sub route title',
},
},
],
},
];
The service should now be able to collect all title
properties defined for the current url. Each time a new title
is found for a child, it will be translated and prepended, ending with YourAppName - Lucca
.
ex: Sub route title - Parent title - YourAppName - Lucca
For dynamic titles, the prependTitle
method from LuTitleStrategy
enables you to add a custom title.
In a component, you could do the following:
const userName: string = this.userService.getCurrentUser();
this.luTitleStrategy.prependTitle(userName);
You can also replace the first fragment using:
const userName: string = this.userService.getOtherUser();
this.luTitleStrategy.overrideFirstTitlePart(userName);
Both prependTitle
and overrideFirstTitlePart
can also be called using Observable<string>
:
const selectedUser$ = this.userStore.selected$;
this.luTitleStrategy.prependTitle(selectedUser$);
You will need to:
@lucca-front/ng
YourAppNameTranslateService
) that implements the ILuTitleTranslateService
provideLuTitleStrategy
in your app.module.ts
/ app.config.ts
provideLuTitleStrategy({
appName: () => 'YourAppName',
translateService: () => inject(YourAppNameTranslateService),
}),
YourAppNameTranslateService
be used in combination with the token LU_TITLE_TRANSLATE_SERVICE
.
This service should implement the ILuTitleTranslateService
interface. It allows you to use any translation service (ngx-translate
, transloco
, ...etc).
You should end up with the following if you are using ngx-translate
:
@Injectable({ providedIn: 'root' })
export class CoreRhTranslateService implements ILuTitleTranslateService {
constructor(private translateService: TranslateService) {}
translate(key: string, args: unknown): string {
return this.translateService.instant(key, args);
}
}
or if you are using transloco
:
@Injectable({ providedIn: 'root' })
export class CoreRhTranslateService implements ILuTitleTranslateService {
constructor(private translateService: TranslocoService) {}
translate(key: string, args: HashMap): string {
return this.translateService.translate(key, args);
}
}
app.module.ts
configIn the app.module.ts
, you need to call provideLuTitleStrategy
in the providers
array:
@NgModule({
providers: [
provideLuTitleStrategy({ translateService: () => inject(YourAppNameTranslateService) }),
]
})
export class AppModule {}
FAQs
A library of icons made by the team @Lucca
The npm package @lucca-front/ng receives a total of 4,009 weekly downloads. As such, @lucca-front/ng popularity was classified as popular.
We found that @lucca-front/ng demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.