Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { MessageService } from './message.service';
- import { Component, OnInit } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent implements OnInit {
- title = 'app';
- message = '';
- ngOnInit(): void {
- this.printMessage();
- }
- constructor(private messageService: MessageService) {
- }
- printMessage(): void {
- this.messageService.printMessage()
- .subscribe(message => this.message = message);
- }
- }
Add Comment
Please, Sign In to add comment