Skip to content

Commit 52e9b86

Browse files
committed
Ship as a custom element
1 parent 0489495 commit 52e9b86

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@angular/common": "^17.0.5",
2525
"@angular/compiler": "^17.0.5",
2626
"@angular/core": "^17.0.5",
27+
"@angular/elements": "^17.1.0",
2728
"@angular/forms": "^17.0.5",
2829
"@angular/localize": "^17.0.5",
2930
"@angular/platform-browser": "^17.0.5",

src/app/app.module.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {NgModule} from "@angular/core";
1+
import {NgModule, Injector} from "@angular/core";
22
import {NgxEditorModule} from "ngx-editor";
33
import {BrowserModule} from "@angular/platform-browser";
4+
import {createCustomElement} from "@angular/elements";
45
import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http";
56
import {OAuthModule} from "angular-oauth2-oidc";
67
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
@@ -230,10 +231,17 @@ import {ActionMenuComponent} from "./view/action-menu/action-menu/action-menu.co
230231
SbbBreadcrumbModule,
231232
SbbAutocompleteModule,
232233
],
233-
bootstrap: [AppComponent],
234+
//bootstrap: [AppComponent],
234235
providers: [
235236
{provide: BASE_PATH, useValue: environment.backendUrl},
236237
{provide: HTTP_INTERCEPTORS, useClass: HttpErrorInterceptor, multi: true},
237238
],
238239
})
239-
export class AppModule {}
240+
export class AppModule {
241+
constructor(private injector: Injector) {}
242+
243+
ngDoBootstrap() {
244+
const element = createCustomElement(AppComponent, { injector: this.injector });
245+
customElements.define("sbb-root", element);
246+
}
247+
}

0 commit comments

Comments
 (0)