aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/success-bar/success-bar.component.ts
blob: f7c7e54306f6349e647cb71c9149340f4244d3a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-success-bar',
  templateUrl: './success-bar.component.html',
  styleUrls: ['./success-bar.component.css']
})
export class SuccessBarComponent implements OnInit {
  public successMsg = '';

  constructor()
  { }

  ngOnInit(): void {
    this.hideMsg();
  }

  showMsg(msg?: string | undefined): void {
    if (msg === undefined) {
      this.successMsg = 'Success!';
    }
    else if (msg.trim() === '') {
      this.successMsg = 'Success!';
    }
    else {
      this.successMsg = msg;
    }
  }

  hideMsg(): void {
    this.successMsg = '';
  }
}