parent
eee87cf3b0
commit
8fbcff9b17
@ -1,17 +0,0 @@ |
||||
button { |
||||
padding: 5px; |
||||
text-decoration: none; |
||||
margin: 2px; |
||||
display: inline-block; |
||||
background-color: #E77620; |
||||
color: white; |
||||
border-radius: 4px; |
||||
} |
||||
button:hover { |
||||
background-color: #42545C; |
||||
} |
||||
button:disabled { |
||||
background-color: #eee; |
||||
color: #ccc; |
||||
cursor: auto; |
||||
} |
@ -1,11 +0,0 @@ |
||||
<div *ngIf="messageService.messages.length"> |
||||
|
||||
<h2>Messages</h2> |
||||
|
||||
<button (click)="messageService.clear()">Clear messages</button> |
||||
|
||||
<div *ngFor='let message of messageService.messages'> |
||||
{{message}} |
||||
</div> |
||||
|
||||
</div> |
@ -1,16 +0,0 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import { MessageService} from "../services/message.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-messages', |
||||
templateUrl: './messages.component.html', |
||||
styleUrls: ['./messages.component.css'] |
||||
}) |
||||
export class MessagesComponent implements OnInit { |
||||
|
||||
constructor(public messageService : MessageService) { } |
||||
|
||||
ngOnInit(): void { |
||||
} |
||||
|
||||
} |
@ -1,20 +0,0 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class MessageService { |
||||
|
||||
messages : string[] = []; |
||||
|
||||
add(message: string){ |
||||
this.messages.push(message) |
||||
} |
||||
|
||||
clear(){ |
||||
this.messages = []; |
||||
} |
||||
|
||||
constructor() { } |
||||
|
||||
} |
Loading…
Reference in new issue