Pass data between HTML and TS
ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ Π΄ΠΈΠ½Π°ΠΌΠΈΠΊΠΈ
Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ Π² ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ΅ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ title
import {Component} from '@angular/core'
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: [
'./card.component.scss'
]
})
export class CardComponent {
title = 'My Card Title'
}
Π§Π΅ΡΠ΅Π· ΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΡΡΠΈΡ Π΄ΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ ΡΡΡ ΠΏΠ΅ΡΠ΅Π½Π½ΡΡ Π² Π½Π°Ρ ΡΠ°Π±Π»ΠΎΠ½:
<div class="card">
<h2>{{ title }}</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci, ratione.</p>
</div>
ΠΠ½ΡΠ΅ΡΠΏΠΎΠ»ΠΈΡΠΎΠ²Π°ΡΡ ΠΌΠΎΠΆΠ½ΠΎ Π²ΡΠ΅, ΡΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ ΠΏΡΠΈΠ²Π΅ΡΡΠΈ ΠΊ ΡΡΡΠΎΠΊΠ΅ β Π»ΡΠ±ΡΠ΅ ΠΏΡΠΎΡΡΡΠ΅ ΡΠΈΠΏΡ. ΠΡΠ»ΠΈ ΠΌΡ ΠΏΠΎΠΏΡΠΎΠ±ΡΠ΅ΠΌ ΠΏΡΠΎΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΠΈΡΠΎΠ²Π°ΡΡ ΠΎΠ±ΡΠ΅ΠΊΡ, ΡΠΎ ΠΌΡ ΠΏΠΎΠ»ΡΡΠΈΠΌ [object Object]
. Π§ΡΠΎΠ±Ρ Π²ΡΠ΅ ΡΠ°ΠΊΠΈ ΡΠ²ΠΈΠ΄Π΅ΡΡ ΡΠΎΠ΄Π΅ΡΠΆΠΈΠΌΠΎΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΠ° ΠΌΠΎΠΆΠ½ΠΎ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ ΡΠ°ΠΊΡΡ ΡΡΡΠΊΡ ΠΊΠ°ΠΊ ΠΏΠ°ΠΉΠΏΡ. ΠΠ°ΠΏΡΠΈΠΌΠ΅Ρ, ΠΊΠΎΠ½Π²Π΅ΡΡΠ½Π΅ΠΌ ΠΎΠ±ΡΠ΅ΠΊΡ Π² json:
<div class="card">
<h2>{{ someObject | json }}</h2>
</div>
Π§Π΅ΡΠ΅Π· ΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΌΠΎΠΆΠ½ΠΎ Π²ΡΠ·ΡΠ²Π°ΡΡ ΠΌΠ΅ΡΠΎΠ΄Ρ (ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½Π½ΡΠ΅ Π² ΠΊΠ»Π°ΡΡΠ΅ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ°)
Π angular ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΡΡΡΠΎΠΈΡΡ ΡΠΈΠΌΠ²ΠΎΠ»Ρ Π΄Π»Ρ ΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΡΡΠΈΠΈ:
import {Component} from '@angular/core'
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: [
'./card.component.scss'
],
interpolation: ['{{', '}}']
})
export class CardComponent {}
Bindings
ΠΡΠΎ ΠΌΠ΅Ρ
Π°Π½ΠΈΠ·ΠΌ ΡΠ²ΡΠ·ΠΊΠΈ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ° ΠΈ ΡΠ°Π±Π»ΠΎΠ½Π°, ΠΊΠΎΡΠΎΡΡΠΉ ΠΏΡΠΈΡΡΡΡΡΠ²ΡΠ΅Ρ Π² Angular. ΠΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ Π² ΠΎΠ΄Π½ΠΎΡΡΠΎΡΠΎΠ½Π½Π΅ΠΌ ΠΏΠΎΡΡΠ΄ΠΊΠ΅ ΡΠ²ΡΠ·ΡΠ²Π°ΡΡ Π΄Π°Π½Π½ΡΠ΅ (ΠΈΠ·ΠΌΠ΅Π½ΠΈΠ»ΠΎΡΡ ΡΡΠΎ-ΡΠΎ Π² ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ΅ β ΠΈΠ·ΠΌΠ΅Π½ΠΈΠ»ΠΎΡΡ Π²ΠΎ view).
ΠΠΎΠΏΡΡΡΠΈΠΌ, ΠΌΡ Ρ
ΠΎΡΠΈΠΌ ΠΌΠ΅Π½ΡΡΡ Π΄ΠΈΠ½Π°ΠΌΠΈΡΠ΅ΡΠΊΠΈ ΠΊΠ°ΠΊΠΎΠΉ-ΡΠΎ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΡΠ°Π±Π»ΠΎΠ½Π° (Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, ΠΊΠ°ΡΡΠΈΠ½ΠΊΡ).
import {Component, OnInit} from '@angular/core'
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: [
'./card.component.scss'
],
interpolation: ['{{', '}}']
})
export class CardComponent implements OnInit {
imgUrl: string = 'https://some.img/img.jpg'
ngOnInit() {
setTimeout(() => {
this.imgUrl = 'https://some.img/img2.jpg'
}, 3000)
}
}
Π html:
<div>
<img src="{{ imgUrl }}">
</div>
ΠΡΠΎ ΡΡΠ°Π±ΠΎΡΠ°Π΅Ρ, Π½ΠΎ ΡΠ°ΠΊΠΎΠΉ ΡΠΈΠ½ΡΠ°ΠΊΡΠΈΡ Π½Π΅ ΡΠΎΠ²ΡΠ΅ΠΌ ΠΊΠΎΡΡΠ΅ΠΊΡΠ΅Π½. ΠΠ»Ρ ΡΡΠΎΠ³ΠΎ Π΅ΡΡΡ ΠΌΠ΅Ρ
Π°Π½ΠΈΠ·ΠΌ binding.
ΠΠ΅Π»Π°Π΅ΡΡΡ ΡΡΠΎ ΡΠ΅ΡΠ΅Π· ΠΎΠ±ΠΎΡΠ°ΡΠΈΠ²Π°Π½ΠΈΠ΅ Π°ΡΡΠΈΠ±ΡΡΠ° Π² ΠΊΠ²Π°Π΄ΡΠ°ΡΠ½ΡΠ΅ ΡΠΊΠΎΠ±ΠΊΠΈ:
<div>
<img [src]="imgUrl">
</div>
Π‘ΠΎΠΎΡΠ², Angualr ΠΏΠΎΠ½ΠΈΠΌΠ°Π΅Ρ, ΡΡΠΎ Π² Π·Π½Π°ΡΠ΅Π½ΠΈΠΈ Π°ΡΡΠΈΠ±ΡΡΠ° Π±ΡΠ΄Π΅Ρ ΠΊΠΎΠ΄ TS (ΠΈΠ»ΠΈ JS).
Event binding (Two Way Binding)
ΠΠ΅Π»Π°Π΅ΡΡΡ ΡΡΠΎ ΡΠ΅ΡΠ΅Π· ΠΎΠ±ΠΎΡΠ°ΡΠΈΠ²Π°Π½ΠΈΡ ΡΠΎΠ±ΡΡΠΈΡ Π² ΠΊΡΡΠ³Π»ΡΠ΅ ΡΠΊΠΎΠ±ΠΊΠΈ ΠΈ ΠΏΡΠΎΠΏΠΈΡΡΠ²Π°Π½ΠΈΡ ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊΠ°:
<div class="card">
<h2>{{ title }}</h2>
<p>{{ testText }}</p>
<div>
<button (click)="changeTitle()">Change Title</button>
<button (click)="title = 'Inline title'">Change Title Inline</button>
</div>
<div>
<!-- $event β ΡΡΠΎ Π½Π°ΡΠΈΠ²Π½ΡΠΉ ΠΈΠ²Π΅Π½Ρ, Π½ΡΠΆΠ΅Π½ Π΄Π»Ρ ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊΠ° -->
<input type="text" (input)="inputHandler($event)" [value]="title">
<!-- ΠΡΡΠ³ΠΎΠΉ Π²Π°ΡΠΈΠ°Π½Ρ (Π±ΠΎΠ»Π΅Π΅ ΠΏΡΠΎΡΡΠΎΠΉ) β ΡΠ΅ΡΠ΅Π· Π»ΠΎΠΊΠ°Π»ΡΠ½ΡΡ ΡΡΡΠ»ΠΊΡ Π½Π° ΡΠ»Π΅ΠΌΠ΅Π½Ρ -->
<input type="text" #myInput (input)="inputHandler2(myInput.value)" [value]="title">
</div>
</div>
Π angular Π΅ΡΡΡ Π²ΡΡΡΠΎΠ΅Π½Π½ΡΠΉ ΠΌΠΎΠ΄ΡΠ»Ρ, ΠΊΠΎΡΠΎΡΡΠΉ ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΡΡΠΎ ΡΠ΅Π°Π»ΠΈΠ·ΠΎΠ²Π°ΡΡ Π΅ΡΠ΅ ΠΏΡΠΎΡΠ΅. ΠΠ»Ρ ΡΡΠΎΠ³ΠΎ Π² Π½Π°ΡΠ΅ΠΌ ΠΌΠΎΠ΄ΡΠ»Π΅, Π² ΠΏΠΎΠ»Π΅ imports ΠΌΡ Π΄ΠΎΠ»ΠΆΠ½Ρ ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠΈΡΡ Π΅ΡΠ΅ ΠΎΠ΄ΠΈΠ½ Π±Π°Π·ΠΎΠ²ΡΠΉ ΠΌΠΎΠ΄ΡΠ»Ρ β FormsModule:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { CardComponent } from './card/card.component';
@NgModule({
declarations: [
AppComponent,
CardComponent
],
imports: [
BrowserModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
ΠΠΎΠ΄ΡΠ»Ρ FormsModule ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ Π² ΡΠ΅Π±Π΅ ΡΡΠ½ΠΊΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎΡΡΡ, ΠΊΠΎΡΠΎΡΠ°Ρ ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΡΠ°Π±ΠΎΡΠ°ΡΡ Ρ ΡΠΎΡΠΌΠ°ΠΌΠΈ, ΠΈ ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ Π² ΡΠ΅Π±Π΅ ngModel, ΠΊΠΎΡΠΎΡΡΠΉ ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ Π΄ΠΎΠ±Π°Π²Π»ΡΡΡ ΠΌΠ΅Ρ
Π°Π½ΠΈΠ·ΠΌ Two Way Binding Π³ΠΎΡΠ°Π·Π΄ΠΎ ΠΏΡΠΎΡΠ΅ (ΠΌΡ ΠΏΡΠΎΡΡΠΎ ΠΎΠ±ΠΎΡΠ°ΡΠΈΠ²Π°Π΅ΠΌ ΠΈ ΠΊΠ²Π°Π΄ΡΠ°ΡΠ½ΡΠ΅ ΠΈ Π² ΠΊΡΡΠ³Π»ΡΠ΅ ΡΠΊΠΎΠ±ΠΊΠΈ ngModel ΠΈ Π² Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎΠΌΠ΅ΡΠ°Π΅ΠΌ ΡΠΎ ΠΏΠΎΠ»Π΅, ΠΊΠΎΡΠΎΡΠΎΠ΅ Ρ
ΠΎΡΠΈΠΌ ΡΠ²ΡΠ·Π°ΡΡ Π² Π΄Π²ΡΡΡΠΎΡΠΎΠ½Π½Π΅ΠΌ ΠΏΠΎΡΡΠ΄ΠΊΠ΅):
<div class="card">
<h2>{{ title }}</h2>
<p>{{ testText }}</p>
<div>
<!-- 2way binding ΡΠ΅ΡΠ΅Π· FormsModule -->
<input type="text" [(ngModel)]="title">
<!-- Π’Π°ΠΊ ΠΆΠ΅, Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΠΎ Π΅ΡΡΡ ΡΠΎΠ±ΡΡΠΈΠ΅ Π΄Π»Ρ ΠΏΠΎΠ΄ΠΏΠΈΡΠΈ Π½Π° ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ ΠΏΠΎΠ»Ρ -->
<input type="text" [(ngModel)]="title" (ngModelChange)="changeHandler()">
</div>
</div>
Pass data between parent and child components
Parent -> Child ( @Input() )
ΠΠ΅Π»Π°Π΅ΡΡΡ ΡΡΠΎ ΠΏΡΡΠ΅ΠΌ ΠΎΠ±ΡΡΠ²Π»Π΅Π½ΠΈΡ ΠΏΠΎΠ»Ρ ΡΠ΅ΡΠ΅Π· Π΄Π΅ΠΊΠΎΡΠ°ΡΠΎΡ @Input()
.
import { Component, OnInit } from '@angular/core';
import { Input } from '@angular/core'
import { Product } from '../products';
export class ChildComponent implements OnInit {
@Input() product!: Product;
@Input('master') masterName = ''; // tslint:disable-line: no-input-rename
// Intercept input property changes with a setter
@Input()
get name(): string { return this._name; }
set name(name: string) {
this._name = (name && name.trim()) || '<no name set>';
}
private _name = '';
constructor() { }
ngOnInit() {
}
}
ΠΠ΄Π΅-ΡΠΎ Π² ΠΎΠ±ΡΡΠ²Π»Π΅Π½ΠΈΠΈ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ°:
<app-product-alerts
[product]="some_product"
[master]="some_master"
[name]="some_name">
</app-product-alerts>
Child -> Parent ( @Output() )
ΠΠ΅Π»Π°Π΅ΡΡΡ ΡΡΠΎ ΠΏΡΡΠ΅ΠΌ ΠΎΠ±ΡΡΠ²Π»Π΅Π½ΠΈΡ ΠΏΠΎΠ»Ρ ΡΠ΅ΡΠ΅Π· Π΄Π΅ΠΊΠΎΡΠ°ΡΠΎΡ @Output()
.
import { Component } from '@angular/core';
import { Input } from '@angular/core';
import { Output, EventEmitter } from '@angular/core';
import { Product } from '../products';
export class ProductAlertsComponent {
@Input() product: Product | undefined;
@Output() notify = new EventEmitter<boolean>();
notify_f(value: boolean) {
this.notify.emit(value);
}
}
ΠΠ΄Π΅-ΡΠΎ Π² Π΄ΡΡΠ³ΠΎΠΌ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ΅
<button (click)="share()">
Share
</button>
<app-product-alerts
[product]="product"
(notify)="onNotify($event)">
</app-product-alerts>
export class SomeParentComponent {
onNotify(value: boolean) {
// some actions
}
}
Calls functions to other components
Calls child's functions from the parent component
ΠΠ΅Π»Π°Π΅ΡΡΡ ΡΠ΅ΡΠ΅Π· ΠΈΠΌΠ΅Π½ΠΎΠ²Π°Π½ΠΈΠ΅ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ° β #childComponent
. ΠΡΠΈΠΌΠ΅Ρ:
<div class="card">
<h2>{{ title }}</h2>
<p>{{ testText }}</p>
<div>
<button (click)="changeTitle(childComponent.value)">Change Title</button>
</div>
<div>
<!-- ΠΡΡΠ³ΠΎΠΉ Π²Π°ΡΠΈΠ°Π½Ρ (Π±ΠΎΠ»Π΅Π΅ ΠΏΡΠΎΡΡΠΎΠΉ) β ΡΠ΅ΡΠ΅Π· Π»ΠΎΠΊΠ°Π»ΡΠ½ΡΡ ΡΡΡΠ»ΠΊΡ Π½Π° ΡΠ»Π΅ΠΌΠ΅Π½Ρ -->
<input type="text" #childComponent (input)="inputHandler2(childComponent.value)" [value]="title">
</div>
</div>
ΠΡΡΠ³ΠΎΠΉ ΡΠΏΠΎΡΠΎΠ± (Π±ΠΎΠ»Π΅Π΅ Π³ΠΈΠ±ΠΊΠΈΠΉ) β ΠΈΠ½ΠΆΠ΅ΠΊΡΠΈΡΡ Π΄ΠΎΡΠ΅ΡΠ½ΠΈΠΉ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ Π²Π½ΡΡΡΡ ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΎΠ³ΠΎ ΡΠ΅ΡΠ΅Π· @ViewChild
. ΠΡΠΈΠΌΠ΅Ρ:
import { AfterViewInit, ViewChild } from '@angular/core';
import { Component } from '@angular/core';
import { ChildComponent } from './child';
@Component({
...,
tempate: `
<div class="seconds">{{ seconds() }}</div>
<app-child></app-child>
`,
...
})
export class ParentComponent implements AfterViewInit {
@ViewChild(ChildComponent)
private childComponent!: ChildComponent;
seconds() {return 0;}
ngAfterViewInit() {
// Redefine `seconds()` to get from the `ChildComponent.seconds` ...
// but wait a tick first to avoid one-time devMode
// unidirectional-data-flow-violation error
// ΠΡΠ°ΡΠΊΠΎ: ΡΡΠΎ Ρ
Π°ΠΊ, ΡΠΊ Π΄ΠΎΡΠ΅ΡΠ½ΠΈΠΉ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ Π½Π΅ ΡΡΡΠ΅ΡΡΠ²ΡΠ΅Ρ, ΠΏΠΎΠΊΠ° Π½Π΅ ΠΎΡΡΠΈΡΡΠ΅ΡΡΡ ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΈΠΉ,
// Π° ΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎ, Π²ΡΠ·ΠΎΠ² ΡΡΠ½ΠΊΡΠΈΠΉ Π½Π΅Π²ΠΎΠ·ΠΌΠΎΠΆΠ΅Π½ ( child.seconds() ).
// ΠΡΠΎΡ ΠΊΠΎΠ΄ Π΄ΠΎΠΆΠΈΠ΄Π°Π΅ΡΡΡ 1 ΡΠΈΠΊ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ, ΠΏΡΠ΅ΠΆΠ΄Π΅ ΡΠ΅ΠΌ ΠΏΠ΅ΡΠ΅ΠΎΠΏΡΠ΅Π΄Π΅Π»ΠΈΡΡ ΡΡΠ½ΠΊΡΠΈΡ
setTimeout(() => this.seconds = () => this.childComponent.seconds, 0);
}
start() { this.childComponent.start(); }
}
Using a service
ΠΡΠΈΠΌΠ΅Ρ ΡΠ΅ΡΠ²ΠΈΡΠ°:
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@Injectable()
export class SomeService {
// Observable string sources
private someStringSource = new Subject<string>();
private someStringSource2 = new Subject<string>();
// Observable string streams
someStringStreams$ = this.someStringSource.asObservable()
someStringStreams2$ = this.someStringSource2.asObservable()
// Service message commands
someSend(value: string) {
this.someStringSource.next(value);
}
someRecv(value: string) {
this.someStringStreams2.next(value);
}
}
Π ΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΈΠΉ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ
import { Component } from '@angular/core';
import { SomeService } from './some.service';
@Component({
...,
template: `
<button (click)="someFunc()">Test</button>
<app-child
*ngFor="let value of values"
[someInput]="value">
</app-child>
`,
providers: [SomeService],
...
})
export class ParentComponent {
history: string[] = [];
constructor(private someService: SomeService) {
someService.someStringStreams$.subscribe(
someValue => {
this.history.push(`${someValue}`);
};
)
}
someFunc() {
this.someService.someSend('some data');
this.history.push('send some data');
}
}
ΠΠΎΡΠ΅ΡΠ½ΠΈΠΉ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ
import { Component, Input, OnDestroy } from '@angular/core';
import { SomeService } from './some.service';
import { Subscription } from 'rxjs';
@Component({
...,
template: `
<button
(click)="confirm()">
Test
</button>
`,
...
})
export class ChildComponent implements OnDestroy {
@Input() someInput = '';
somedata = '<no data>';
subscription: Subscription;
constructor(private someService: SomeService) {
this.subscription = someService.someStringStreams2$.subscribe(
somedata => {
this.somedata = somedata;
}
)
}
confirm() {
this.someService.someRecv(this.someInput);
}
ngOnDestroy() {
// prevent memory leak when component destroyed
this.subscription.unsubscribe();
}
}
ΠΡΠΏΠΈΡΠΊΠ° ΠΎΡ ΡΠΎΠ±ΡΡΠΈΠΉ Π² ngOnDestroy() ΠΊΡΠ°ΠΉΠ½Π΅ Π²Π°ΠΆΠ½Π° Π΄Π»Ρ Π΄ΠΎΡΠ΅ΡΠ½ΠΈΡ
ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ², ΡΠΊ ΡΡΠΎ Π·Π°ΡΠΈΡΠ°Π΅Ρ ΠΎΡ ΡΡΠ΅ΡΠ΅ΠΊ ΠΏΠ°ΠΌΡΡΠΈ (Π΄Π»Ρ ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΈΡ
ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠΎΠ² ΡΡΠΎΠ³ΠΎ Π΄Π΅Π»Π°ΡΡ Π½Π΅ Π½Π°Π΄ΠΎ, ΡΠΊ ΡΠ΅ΡΠ²ΠΈΡ SomeService Π·Π°ΠΊΡΡΠ²Π°Π΅ΡΡΡ Π²ΠΌΠ΅ΡΡΠ΅ Ρ ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΈΠΌ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠΎΠΌ).