Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit, Input } from '@angular/core';
- // bu component anotasyonunun içinde metadatalar yer bulunur
- @Component({
- selector: 'summary',
- templateUrl: './summary.component.html',
- styleUrls: ['./summary.component.css']
- })
- export class SummaryComponent implements OnInit {
- constructor() { }
- ngOnInit() {
- }
- // Bu anotasyon, parent component'den gönderilen değeri child componente (yani summary componenti) gönderir.
- // Stock değeri sağlandığında summary.component.ts class'ı çağrılır.
- // Parent component tarafından kullanım şekli '<summary [stock]="stockData"></summary>'.
- // Burada parent daki 'stockData' verisi, child'a gönderilir.
- @Input() stock: any;
- // stock değerindeki değişikliğin negatifliğini kontrol eder
- isNegative() { return (this.stock && this.stock.change < 0); }
- // stock değerindeki değişikliğin pozitifliğini kontrol eder
- isPositive() { return (this.stock && this.stock.change > 0); }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement