【发布时间】:2021-02-09 15:23:48
【问题描述】:
我的 html 中有这个 ngbCollapse:
<div style="margin: 1.5em 1.5em;" [ngbCollapse]="isCollapsed">
//things
</div>
在我的组件中,我会在每次 isCollapsed 更改时调用一个方法:
export class Component implements OnInit {
public isCollapsed = true;
constructor(private Serv: _service) {}
ngOnInit() {}
//Everytime isCollapsed changes I would call this method
isCollapsedInService () {
this._service.set(isCollapsed);
}
【问题讨论】:
-
这就是 observables/subjects 的用途:rxjs-dev.firebaseapp.com/guide/observable
标签: html angular typescript observable