Skip to content

Instantly share code, notes, and snippets.

@miloszpp
Created October 8, 2017 10:38
Show Gist options
  • Save miloszpp/f6e68d6a4b7fbd50ec8389781a6fcc9f to your computer and use it in GitHub Desktop.
Save miloszpp/f6e68d6a4b7fbd50ec8389781a6fcc9f to your computer and use it in GitHub Desktop.
Szkolenie Angular: ćwiczenie 1
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