Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created July 11, 2018 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save debugmodedotnet/528f8427d9043fdc4851a1f046bacce5 to your computer and use it in GitHub Desktop.
Save debugmodedotnet/528f8427d9043fdc4851a1f046bacce5 to your computer and use it in GitHub Desktop.
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