我有以下簡單的角2的應用: app.component.ts角2 RC5 ngStyle數據不從父組件傳播
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<h1>Test</h1>
<test-component [Height] = "300" [Width]="300"></test-component>`
})
export class AppComponent {
public constructor() {}
}
和實際測試部件:
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'test-component',
template: `
<div [ngStyle]="{'height' : Height + 'px', 'width' : Width + 'px'}"></div>
`
})
export class TestComponent implements OnInit {
@Input() Height : any;
@Input() Width : any;
constructor() { }
ngOnInit() { }
}
然而,ngStyle數據不會傳播到測試組件。我做錯了什麼或在RC5中破壞了?
謝謝
做工精細這裏:http://plnkr.co/edit/owlvg94BINLcOHoNCyKC –