ДМ
Size: a a a
ДМ
S
ДМ
ДМ
ДМ
ДМ
S
ДМ
S
ДМ
S
ДМ
S
class Service {
vehicles = this.http(...).pipe(shareReplay(...))
colors = this.http(...).pipe(shareReplay(...))
state = combineLatest(..., vehicles, colors).pipe(
map(...),
shareReplay(...)
)
getState() .... {
return this.state;
}
getVehiles() ... {
return this.vehicles;
}
getColors() ... {
return this.colors;
}
}
ДМ
PD
this
в методах компонента<ng-container *ngFor="let message of messages">
<div (click)="onClick()"></div>
</ng-container>
class Component {
name = 'name of the component';
messages = [{ name: 'messageA' }, { name: 'messageB' }];
someMethod() {
console.log(this.name) // name of the component
// this === Component
}
onClick() {
console.log(this.name) // messageA
// this == { name: 'messageA' }
}
}
S