import { Component, OnInit } from '@angular/core'; import { ToastService } from './shared'; @Component({ selector: 'sg-app', template: ` `, providers: [ToastService] }) export class AppComponent implements OnInit { constructor(private toastService: ToastService) { } hide() { this.toastService.hide(); } show() { this.toastService.show(); } ngOnInit() { this.toastService.activate('Hello style-guide!'); } }