From 697af174620f89bb4aec26d015f53c877cd31c97 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Mon, 31 Oct 2022 21:52:28 +0300 Subject: [PATCH] Add callback for ng route commands for go --- src/app/app.component.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 79accdb..395fc07 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,10 +1,20 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { Router, RouterEvent } from '@angular/router'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], }) -export class AppComponent { + +export class AppComponent implements OnInit{ + constructor(private router: Router){ } + + ngOnInit(){ + document.addEventListener('GoChangeRoute_Callback', (event:any) => { + this.router.navigate([event.detail]) + console.log("here") + }) + } title = 'go-web'; }