Created
October 8, 2017 10:38
-
-
Save miloszpp/f6e68d6a4b7fbd50ec8389781a6fcc9f to your computer and use it in GitHub Desktop.
Szkolenie Angular: ćwiczenie 1
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'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<h1 [style.textTransform]="textTransform" [style.color]="color">Zespół: {{name}}</h1> | |
<p>{{bio}}</p> | |
<a [href]="wikipediaUrl">Wikipedia</a><br /> | |
<button (click)="changeTransform()">Wielkie/małe litery</button> | |
<button (click)="changeColor()">Zmień kolor</button> | |
`, | |
styles: [] | |
}) | |
export class AppComponent { | |
name = "Slayer"; | |
bio = "Amerykański zespół heavymetalowy założony w Los Angeles w 1981 roku przez Jamesa Hetfielda i Larsa Ulricha." | |
wikipediaUrl = "https://pl.wikipedia.org/wiki/Metallica" | |
textTransform = "uppercase" | |
color = "red" | |
changeTransform() { | |
if (this.textTransform === "uppercase") this.textTransform = "lowercase"; | |
else this.textTransform = "uppercase"; | |
} | |
changeColor() { | |
if (this.color === "red") this.color = "blue"; | |
else this.color = "red"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment