Advertisement
Guest User

Untitled

a guest
Oct 9th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import { Component, OnInit, Input } from '@angular/core';
  2.  
  3. // bu component anotasyonunun içinde metadatalar yer bulunur
  4. @Component({
  5. selector: 'summary',
  6. templateUrl: './summary.component.html',
  7. styleUrls: ['./summary.component.css']
  8. })
  9. export class SummaryComponent implements OnInit {
  10.  
  11. constructor() { }
  12.  
  13. ngOnInit() {
  14. }
  15.  
  16. // Bu anotasyon, parent component'den gönderilen değeri child componente (yani summary componenti) gönderir.
  17. // Stock değeri sağlandığında summary.component.ts class'ı çağrılır.
  18. // Parent component tarafından kullanım şekli '<summary [stock]="stockData"></summary>'.
  19. // Burada parent daki 'stockData' verisi, child'a gönderilir.
  20. @Input() stock: any;
  21.  
  22. // stock değerindeki değişikliğin negatifliğini kontrol eder
  23. isNegative() { return (this.stock && this.stock.change < 0); }
  24.  
  25. // stock değerindeki değişikliğin pozitifliğini kontrol eder
  26. isPositive() { return (this.stock && this.stock.change > 0); }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement