Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The Angular component with ngZone to interact with Ethereum
import { Component, OnInit, OnDestroy, NgZone } from '@angular/core';
import { EthService } from './ethereum/eth.service';
selector: 'app-root',
template: '<p>Current Account: {{ address }}',
styles: []
export class AppComponent implements OnInit, OnDestroy {
public address: string;
public alive = true;
constructor(private eth: EthService, private zone: NgZone) {}
ngOnInit() {
.subscribe((account: string) => => {
this.address = account;
ngOnDestroy() {
this.alive = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment