java-go experiments

This commit is contained in:
wagonsoftware 2022-10-17 16:54:44 +03:00
parent 07e7c8845d
commit 188f7b6aa2
4 changed files with 31 additions and 11 deletions

View File

@ -1,3 +1 @@
Test (version: {{version}}) <app-games-bar></app-games-bar>
<button (click)="getVersion()">Get version</button>

View File

@ -0,0 +1,7 @@
a {
padding: 10px;
&.active {
background: green;
}
}

View File

@ -1,5 +1,4 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { GetVersion, GetVersionCallbackDetail } from './services/go';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -10,13 +9,28 @@ export class AppComponent {
title = 'go-web'; title = 'go-web';
version: string | null = null; version: string | null = null;
games: { id: string; name: string }[] = [
{
id: 'game-1',
name: 'Game one',
},
{
id: 'game-2',
name: 'Game two',
},
{
id: 'game-3',
name: 'Game three',
},
];
constructor() {} constructor() {}
getVersion() { getVersion() {
document.addEventListener('GetVersion_Callback', (event: Event): void => { // document.addEventListener('GetVersion_Callback', (event: Event): void => {
if (!(event instanceof CustomEvent<string>)) return; // if (!(event instanceof CustomEvent<string>)) return;
this.version = event.detail; // this.version = event.detail;
}); // });
GetVersion(); // GetVersion();
} }
} }

View File

@ -6,12 +6,13 @@ import {
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './modules/app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { GamesBarModule } from './components/games-bar/games-bar.module';
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent],
imports: [BrowserModule, AppRoutingModule], imports: [BrowserModule, AppRoutingModule, GamesBarModule],
providers: [ providers: [
{ provide: APP_BASE_HREF, useValue: '/' }, { provide: APP_BASE_HREF, useValue: '/' },
{ provide: LocationStrategy, useClass: HashLocationStrategy }, { provide: LocationStrategy, useClass: HashLocationStrategy },