我对angular2应用程序的工作中,我的团队成员使用getter和setter来设置输入属性,遵循的是它使用getter二传手在角2应用
private _showModal;
@Input() set showModal(showModal){
this._showModal = showModal;
}
get showModal() {
return this._showModal;
}
一个很好的做法,但我不知道它是一个很好的方法来做到这一点。我认为应该使用getter setter,以便在设置或获取值时dev必须进行一些验证或检查或执行其他功能的情况下