【发布时间】:2022-01-27 02:13:38
【问题描述】:
所以我是 Angular 新手,正在尝试构建一个小项目。
如何从服务中获取数据到类中并发送到 html 组件?
// service.groups.ts
export class GroupService {
public getAll(): void {
return // httpService call...works!
}
}
// groups.class.ts
import {GroupService} from '@core/services/group/group.service';
export class {
protected constructor(private groupService: GroupService);
public get groupData(): string {
let data = this.groupService.getAll();
// some extra filtering comes here
return data;
}
}
// wrapper.component.html
<wrapper[group]="groupData"></wrapper>
// wrapper.component.ts
export class WrapperComponent {
@Input()
public group: string;
}
// wrapper.html
<div>{{ group }}</div>//not working
【问题讨论】:
标签: angular typescript