Facebook
From asd, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 138
  1. import { Component } from '@angular/core';
  2.  
  3. @Component({
  4.   selector: 'app-root',
  5.   template: `
  6.     <div  flex; flex-direction: column; align-items: center; background-color: gray; padding: 20px;">
  7.       <h1 [style.background-color]="kolorTlaNapisu">{{ napis }}</h1>
  8.     </div>
  9.     <div  flex; flex-direction: column; align-items: center;">
  10.       <img   1px solid black; width: 200px; height: auto; margin-top: 20px; padding: 5px;">
  11.     </div>
  12.     <div  flex; flex-direction: column; align-items: center; margin-top: 20px;">
  13.       <button (click)="zmienKolorTlaNapisu()">Zmień kolor tła napisu</button>
  14.     </div>
  15.   `,
  16.   styleUrls: ['./app.component.css'],
  17.   standalone: true
  18. })
  19. export class AppComponent {
  20.   title = 'wizytowka';
  21.   napis = 'Nazywam się Adrian Gołębiewski';
  22.   kolorTlaNapisu = 'gray';
  23.   zdjecieUrl = 'https://m.wm.pl/2020/01/orig/0000005900-24831520-920893851400482-5986523915120031049-o-604944.jpg';
  24.  
  25.   zmienKolorTlaNapisu() {
  26.     this.kolorTlaNapisu = '#' + Math.floor(Math.random()*16777215).toString(16);
  27.   }
  28. }
  29.