angular4输入属性(Input) Posted on 2018-06-18 Input 是输入属性,用来定义组件的内的输入属性,主要用来实现父组件想子组件传递数据 123456789101112131415161718192021222324252627import { Component, Input } from "@angular/core";@Component({ selector: 'dex-counter'})export class CounterComponent { // 变量 _count: number = 0; biggerThanTen: boolean = false; constrcutor() { } // @Input('value') count: number = 0; // set @Input() set count(num: number) { this.biggerThanTen = num > 10; this._count = num; } get count():number { return this._count; }} ngOnChanges