Skip to content

Instantly share code, notes, and snippets.

@jorgeucano
Created February 27, 2018 01:58
Show Gist options
  • Select an option

  • Save jorgeucano/9fcea2d75060e8f4d813d4ee018effac to your computer and use it in GitHub Desktop.

Select an option

Save jorgeucano/9fcea2d75060e8f4d813d4ee018effac to your computer and use it in GitHub Desktop.
import { Component, OnInit, OnDestroy } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, OnDestroy {
title = 'app works!';
constructor() {
console.log('soy un constructor');
}
ngOnInit() {
console.log('esto se ejecuta en el momento que arranca a dibujarse el componente');
}
ngOnDestroy() {
console.log('esto se ejecuta en el momento antes de que se destruya el componente y se cargue otro');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment