From 72140a653d1d2b5f95d45b73b0806a57052ef272 Mon Sep 17 00:00:00 2001 From: adrian2024lsp Date: Tue, 8 Oct 2024 13:38:04 +1300 Subject: [PATCH] fix(angular): update to standalone for new angular convention --- verify/angular/src/app/app.component.ts | 19 ++++++++++--------- verify/angular/src/app/app.module.ts | 25 ------------------------- verify/angular/src/main.ts | 10 +++------- 3 files changed, 13 insertions(+), 41 deletions(-) delete mode 100644 verify/angular/src/app/app.module.ts diff --git a/verify/angular/src/app/app.component.ts b/verify/angular/src/app/app.component.ts index 8f95ab146..dbd461174 100644 --- a/verify/angular/src/app/app.component.ts +++ b/verify/angular/src/app/app.component.ts @@ -3,24 +3,25 @@ * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ -import { AfterViewInit, Component } from '@angular/core'; -import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper'; -import { jsonClientUserConfig } from 'monaco-languageclient-examples/json-client'; +import { AfterViewInit, Component } from "@angular/core"; +import { MonacoEditorLanguageClientWrapper } from "monaco-editor-wrapper"; +import { jsonClientUserConfig } from "monaco-languageclient-examples/json-client"; @Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] + selector: "app-root", + templateUrl: "./app.component.html", + styleUrls: ["./app.component.css"], + standalone: true, }) export class MonacoEditorComponent implements AfterViewInit { - title = 'angular-client'; + title = "angular-client"; initDone = false; async ngAfterViewInit(): Promise { const wrapper = new MonacoEditorLanguageClientWrapper(); - const htmlElement = document.getElementById('monaco-editor-root'); + const htmlElement = document.getElementById("monaco-editor-root"); try { - await wrapper.initAndStart(jsonClientUserConfig , htmlElement ); + await wrapper.initAndStart(jsonClientUserConfig, htmlElement); } catch (e) { console.error(e); } diff --git a/verify/angular/src/app/app.module.ts b/verify/angular/src/app/app.module.ts deleted file mode 100644 index 0887cca9d..000000000 --- a/verify/angular/src/app/app.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) 2023 TypeFox and others. - * Licensed under the MIT License. See LICENSE in the package root for license information. - * ------------------------------------------------------------------------------------------ */ - -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -import { MonacoEditorComponent } from './app.component'; - -@NgModule({ - declarations: [ - MonacoEditorComponent - ], - imports: [ - BrowserModule - ], - providers: [], - bootstrap: [ - MonacoEditorComponent - ] -}) -export class AppModule { - -} diff --git a/verify/angular/src/main.ts b/verify/angular/src/main.ts index 0365cfd40..415acfff0 100644 --- a/verify/angular/src/main.ts +++ b/verify/angular/src/main.ts @@ -3,10 +3,6 @@ * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; - -platformBrowserDynamic().bootstrapModule(AppModule) - .catch((err: Error) => { - console.error(err); - }); +import { bootstrapApplication } from "@angular/platform-browser"; +import { MonacoEditorComponent } from "./app/app.component"; +bootstrapApplication(MonacoEditorComponent);