angular-cn/public/docs/_examples/style-guide/ts/03-01/app/app.component.ts

19 lines
441 B
TypeScript
Raw Normal View History

2016-05-18 09:53:13 -04:00
import { Component, OnInit } from '@angular/core';
import { ExceptionService } from './shared';
2016-05-18 09:53:13 -04:00
@Component({
selector: 'sg-app',
template: '<div>The expected error is {{errorCode}}</div>',
providers: [ExceptionService]
})
export class AppComponent implements OnInit {
errorCode: number;
constructor(private exceptionService: ExceptionService) { }
ngOnInit() {
this.errorCode = this.exceptionService.getException();
}
}