1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 06:54:07 +00:00

[CL-134] Use standalone components

This commit is contained in:
Shane Melton
2023-10-04 16:25:49 -07:00
parent 42b4b18bb7
commit 75d8021c55
3 changed files with 6 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import { Directive, TemplateRef } from "@angular/core";
*/
@Directive({
selector: "[bit-i18n-part]",
standalone: true,
})
export class I18nPartDirective {
constructor(public templateRef: TemplateRef<any>) {}

View File

@@ -9,6 +9,8 @@ import {
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { SharedModule } from "../shared";
import { I18nPartDirective } from "./i18n-part.directive";
interface I18nStringPart {
@@ -38,6 +40,7 @@ interface I18nStringPart {
*/
@Component({
selector: "[bit-i18n],bit-i18n",
imports: [SharedModule],
template: `
<ng-container *ngFor="let part of translationParts">
<ng-container *ngIf="part.templateRef != undefined; else text">
@@ -48,6 +51,7 @@ interface I18nStringPart {
<ng-template #text>{{ part.text }}</ng-template>
</ng-container>
`,
standalone: true,
})
export class I18nComponent implements AfterContentInit {
@Input("key")

View File

@@ -6,8 +6,7 @@ import { I18nPartDirective } from "./i18n-part.directive";
import { I18nComponent } from "./i18n.component";
@NgModule({
imports: [SharedModule],
declarations: [I18nComponent, I18nPartDirective],
imports: [SharedModule, I18nComponent, I18nPartDirective],
exports: [I18nComponent, I18nPartDirective],
})
export class I18nModule {}