Created
July 11, 2018 12:23
-
-
Save debugmodedotnet/528f8427d9043fdc4851a1f046bacce5 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 } from '@angular/core'; | |
import { ErrorService } from './errormessage.service'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<input [(ngModel)]='err' type='text'/> | |
<button (click)='setError()'>set error</button> | |
`, | |
providers: [ErrorService] | |
}) | |
export class AppComponent { | |
constructor(private errorservice: ErrorService) {} | |
err: string; | |
setError() { | |
this.errorservice.logError(this.err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment