所以我现在遇到输入绑定问题,因为我已升级到RC1。以下是我对该观点的看法:
<form class="form-inline">
<div class="form-group">
<select id="limitControl" class="form-control"
[(ngModel)]="limit" (change)="limitChanged($event)">
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="0">All</option>
</select>
<label for="limitControl"> {{recordType}} per page</label>
</div>
</form>
这是以下组件的视图:
@Component({
selector: 'limiter',
templateUrl: 'frontend/common/limiter/view.html',
styleUrls: ['frontend/common/limiter/style.css']
})
export class LimiterComponent {
limit: number = 10;
@Input() recordType: string;
@Output() limitChangedEvent = new EventEmitter<number>();
limitChanged($event) {
this.limitChangedEvent.emit($event.currentTarget.value);
}
}
最后,这是由它的父母调用的:
<limiter (limitChangedEvent)="limitChanged($event)"
[recordType]="Campaigns"></limiter>
recordType似乎没有传递给子组件。有人有什么想法吗?
答案 0 :(得分:0)
<limiter (limitChangedEvent)="limitChanged($event)"
record-type="Campaigns"></limiter>
父组件:
VARS <- colnames(DF)[-1]
y <- VARS[apply(DF[, -1], MARGIN = 1, FUN = which.min)]
DF$y <- y
答案 1 :(得分:0)
我认为这个问题与命名约定有关。查看Input
文档here,注意您正在使用 camelCasing 作为 DOM 绑定 - 而文档显示了连字符呢?
而不是
<limiter (limitChangedEvent)="limitChanged($event)"
[recordType]="Campaigns"></limiter>
试试这个
<limiter (limitChangedEvent)="limitChanged($event)"
record-type="Campaigns"></limiter>