Skip to content

Instantly share code, notes, and snippets.

@miloszpp
Created October 9, 2017 20:57
Show Gist options
  • Save miloszpp/cf8ea531f35ac45812a36f12580db33c to your computer and use it in GitHub Desktop.
Save miloszpp/cf8ea531f35ac45812a36f12580db33c to your computer and use it in GitHub Desktop.
Szkolenie Angular: ćwiczenie 5
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-band-details-photo',
template: `
<label><input type="checkbox" [(ngModel)]="showPhoto" />Pokaż zdjęcie</label><br />
<img *ngIf="showPhoto" [src]="photoUrl" width="300" />
`,
styles: []
})
export class BandDetailsPhotoComponent {
@Input() photoUrl: string;
}
<h1 [style.textTransform]="textTransform" [style.color]="color">
<button (click)="previous()">&lt;</button> Zespół: {{band.name}}
<button (click)="next()">&gt;</button>
</h1>
<div>
<label><input type="checkbox" [(ngModel)]="showBio" />Pokaż biografię</label>
<p *ngIf="showBio">{{band.bio}}</p>
</div>
<div>
Gatunki muzyczne:
<ul>
<li *ngFor="let genre of band.genres">{{genre}}</li>
</ul>
</div>
<div>
Członkowie zespołu:
<ul>
<li *ngFor="let member of band.members">{{member}}</li>
</ul>
</div>
<div>
<a [href]="band.links.wikipediaUrl">Wikipedia</a><br />
<button (click)="changeTransform()">Wielkie/małe litery</button>
<button (click)="changeColor()">Zmień kolor</button><br />
</div>
<div>
<app-band-details-photo [photoUrl]="band.links.photoUrl"></app-band-details-photo>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment