Created
August 27, 2019 16:57
-
-
Save hetdev/58a8bfa1412cfe4fa9ef598201f9339e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, Input, OnChanges, OnDestroy, OnInit, SimpleChange} from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'] | |
}) | |
export class AppComponent implements OnInit, OnChanges, OnDestroy { | |
title = 'phoenix-wc-wiki-ngx-lt'; | |
@Input() token: string; | |
constructor() { | |
console.log('token constructor=' + this.token); | |
} | |
ngOnInit() { | |
console.log('token ngOnInit=' + this.token); | |
window.addEventListener('phoenix-wc-wiki-ngx-ce-data-sent-test', this.customEventListenerFunction, true); | |
} | |
customEventListenerFunction(event) { | |
console.log('testfunc - ' , event.detail); | |
} | |
ngOnChanges(changes: {[token: string]: SimpleChange}) { | |
// check the object "changes" for new data | |
console.log('token ngOnChanges=' + this.token); | |
} | |
ngOnDestroy(): void { | |
window.removeEventListener('changeNameToCustomEvent', this.customEventListenerFunction, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment