Diyelim ki bir Angular2 Bileşenim var
//home.component.ts
import { Component } from 'angular2/core';
@Component({
selector: "home",
templateUrl: "app/components/templates/home.component.html",
styleUrls: ["app/components/styles/home.component.css"]
})
export class HomeComponent {
public width: Number;
public height: Number;
}
Bu bileşen için şablon html dosyası
//home.component.html
<div class="home-component">Some stuff in this div</div>
Ve son olarak bu bileşen için css dosyası
//home.component.css
.home-component{
background-color: red;
width: 50px;
height: 50px;
}
Gördüğünüz gibi sınıfta 2 özellik var widthve height. Genişlik ve yükseklik için css stillerinin genişlik ve yükseklik özelliklerinin değerleriyle eşleşmesini ve özellikler güncellendiğinde, div'in genişlik ve yüksekliğinin güncellenmesini istiyorum. Bunu başarmanın doğru yolu nedir?