[英]accessing child components data in other component's array in angular
我正在尝试将 Array(5) 中的 5 设置为此代码中的另一个变量:
我正在尝试做的事情:
export class HelloComponent {
@Input() page: number;
active = 0;
pages;
constructor() {
this.pages = Array(this.page) //rather than Array(5)
.fill(0)
.map((x, i) => i);
this.pages.pop();
}
get currentPage() {
return this.active;
}
}
这是堆栈闪电战
老实说,我不确定你想在这里做什么,但是看看你的 StackBlitz 演示的这个分支。
这是你想做的吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.