И
Size: a a a
И
IZ
IZ
J
И
PS
Вキ
PS
И
И
И
И
КС
// ui-left-right-control.component.html
<div class="left-right-control">
<div
class="left-right-control__item mr-2"
[ngClass]="{
'left-right-control__item--selected': !!model.left
}"
(click)="toggleModel('left')"
>
L
</div>
<div
class="left-right-control__item"
[ngClass]="{
'left-right-control__item--selected': !!model.right
}"
(click)="toggleModel('right')"
>
R
</div>
</div>
// ui-left-right-control.component.ts
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { UiLeftRightControlModel } from './ui-left-right-control.model';
@Component({
selector: 'ui-left-right-control',
templateUrl: './ui-left-right-control.component.html',
styleUrls: ['./ui-left-right-control.component.scss'],
})
export class UiLeftRightControlComponent implements OnInit {
@Input('ngModel') model: UiLeftRightControlModel;
@Output('ngModelChange') modelChange = new EventEmitter<UiLeftRightControlModel>();
constructor() {}
ngOnInit() {}
toggleModel(side: 'left' | 'right'): void {
this.model[side] = !this.model[side];
this.modelChange.emit(this.model);
}
}
// ui-left-right-control.model.ts
export class UiLeftRightControlModel {
left: boolean;
right: boolean;
}
Cannot read property 'left' of undefined?DS

return next.handle(request)
.pipe(catchError(error => {
if (error instanceof HttpErrorResponse && error.status === 401) {
return this.handle401Error(req, next);
}
return throwError(error);
И
И
H
a
RK