Скажем, у меня есть Angular2 Component
//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;
}
Шаблон html файла для этого компонента
//home.component.html
<div class="home-component">Some stuff in this div</div>
И наконец, файл css для этого компонента
//home.component.css
.home-component{
background-color: red;
width: 50px;
height: 50px;
}
Как вы видите, в классе есть 2 свойства, width
и height
. Я хотел бы, чтобы стили css для ширины и высоты соответствовали значениям свойств ширины и высоты и при обновлении свойств, ширине и высоте обновления div. Каков правильный способ сделать это?