{"id":465836,"date":"2025-07-03T09:28:50","date_gmt":"2025-07-03T09:28:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=465836"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=465836","title":{"rendered":"<span>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Injector \u0432 Angular \u0438 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 @Optional, @SkipSelf, @Host<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <code>Injector<\/code> \u0432 Angular, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u044b <code>@Optional<\/code>, <code>@SkipSelf<\/code>, <code>@Host<\/code>, \u0438 \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 <code>root<\/code>, \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. <\/p>\n<h3>\u041a\u0430\u043a Angular \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438: \u0430 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0434\u0451\u0442 \u0432\u0432\u0435\u0440\u0445<\/h3>\n<p>\u0412 Angular \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0433\u043e. Injector \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0449\u0435\u0442 \u0442\u0432\u043e\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445 \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443 \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u043e\u0432. <\/p>\n<pre><code>AppInjector (\u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f)   \u251c\u2500\u2500 ModuleInjector (\u0444\u0438\u0447\u0435\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438)   \u2502     \u2514\u2500\u2500 ComponentInjector (\u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442)   \u2502             \u2514\u2500\u2500 DirectiveInjector (\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b\/\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u0432\u043d\u0443\u0442\u0440\u0438)<\/code><\/pre>\n<p>Angular \u0441\u043c\u043e\u0442\u0440\u0438\u0442: \u201c\u0410\u0433\u0430, \u0442\u0443\u0442 \u0443 \u043c\u0435\u043d\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u041e\u043d \u0445\u043e\u0447\u0435\u0442 <code>MyService<\/code>. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044e, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043d\u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440. \u041d\u0435\u0442? \u041f\u043e\u0434\u043d\u0438\u043c\u0443\u0441\u044c \u0432\u044b\u0448\u0435 \u2014 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c. \u041d\u0435\u0442? \u0422\u043e\u0433\u0434\u0430 \u0432 AppModule. \u041d\u0430\u0448\u0451\u043b? \u041e\u043a\u0435\u0439, \u0432\u043e\u0442.\u201d<\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">@Injectable() export class LocalLogger {   log(msg: string) {     console.log('[LOCAL]', msg);   } }  @Component({   selector: 'logger-demo',   template: `&lt;p&gt;Check console&lt;\/p&gt;`,   providers: [LocalLogger] \/\/ \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 }) export class LoggerComponent {   constructor(logger: LocalLogger) {     logger.log('Hello from LoggerComponent');   } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>LocalLogger<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0438 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b\u0448\u0435 \u043f\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 <code>Logger<\/code>, \u044d\u0442\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u042d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443. \u0410 \u0432\u043e\u0442 \u0434\u0430\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e&#8230;<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 @Optional, @SkipSelf, @Host \u2014 \u043e\u0447\u0435\u043d\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u043a\u0438<\/h3>\n<h4>@Optional()<\/h4>\n<p>\u0415\u0441\u043b\u0438 Angular \u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442 \u043d\u0443\u0436\u043d\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u043e\u043d \u0431\u0440\u043e\u0441\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e: &#171;\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u2014 \u0445\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043d\u0435 \u0431\u0435\u0434\u0430&#187;. \u0412\u043e\u0442 \u0442\u043e\u0433\u0434\u0430 \u0438 \u043d\u0443\u0436\u0435\u043d <code>@Optional()<\/code>.<\/p>\n<pre><code class=\"typescript\">@Component({   selector: 'optional-demo',   template: `...`, }) export class OptionalComponent {   constructor(@Optional() private config?: OptionalConfigService) {     if (config) {       config.apply();     } else {       console.warn('No OptionalConfigService found. Using defaults.');     }   } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u043b\u0438 <code>OptionalConfigService<\/code> \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 <code>undefined<\/code>, \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u043f\u0430\u0434\u0451\u0442.<\/p>\n<h4>@SkipSelf()<\/h4>\n<p>\u0410 \u043e\u043d \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u201c\u0418\u0449\u0438, \u043d\u043e \u043d\u0435 \u0443 \u043c\u0435\u043d\u044f. \u042f \u2014 \u043d\u0435 \u0432 \u0441\u0447\u0451\u0442. \u041d\u0430\u0447\u0438\u043d\u0430\u0439 \u0441 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f.\u201d<\/p>\n<p>\u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u043a\u0435\u0439\u0441:<\/p>\n<pre><code class=\"typescript\">@Injectable() export class CoreService {}  @Component({   selector: 'child',   template: `...`,   providers: [CoreService] \/\/ \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c }) export class ChildComponent {   constructor(@SkipSelf() core: CoreService) {     \/\/ \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442 CoreService \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043d\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430   } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u043d\u0435 \u043f\u0435\u0440\u0435\u0431\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439.<\/p>\n<h4>@Host()<\/h4>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. <code>@Host()<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u201c\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0441\u044c \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430. \u0412\u044b\u0448\u0435 \u2014 \u043d\u0435 \u043b\u0435\u0437\u044c.\u201d<\/p>\n<pre><code class=\"typescript\">@Directive({   selector: '[track-host]', }) export class TrackHostDirective {   constructor(@Host() private logger: LocalLogger) {     \/\/ \u043d\u0430\u0439\u0434\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 LocalLogger \u0432 \u0445\u043e\u0441\u0442-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435, \u0433\u0434\u0435 \u043f\u043e\u0432\u0435\u0448\u0435\u043d\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430   } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0434\u043d\u0438\u043c \u0445\u043e\u0441\u0442\u043e\u043c. \u0412\u044b\u0440\u0443\u0447\u0430\u0435\u0442 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<h3>\u0423\u0440\u043e\u0432\u043d\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432<\/h3>\n<h4>providedIn: &#8216;root&#8217;<\/h4>\n<pre><code class=\"typescript\">@Injectable({ providedIn: 'root' }) export class ApiService {}<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u2014 &#171;\u0441\u043e\u0437\u0434\u0430\u0439 \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435&#187;. Singleton. \u0418 Angular \u043f\u043e\u0434\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 <code>AppInjector<\/code>.<\/p>\n<p>\u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <strong>\u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/strong>. <\/p>\n<h4>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435<\/h4>\n<pre><code class=\"typescript\">@NgModule({   providers: [AnalyticsService], }) export class AnalyticsModule {}<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <code>AnalyticsService<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u043d\u0430 \u0432\u0435\u0441\u044c \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u0437\u0430\u0441\u0430\u0434\u0430: \u0435\u0441\u043b\u0438 \u0442\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <strong>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437<\/strong> \u2014 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<h4>\u0412 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435<\/h4>\n<pre><code class=\"typescript\">@Component({   providers: [LocalStorageService], }) export class MyComponent {}<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u2014 \u0441\u0432\u043e\u044f \u043a\u043e\u043f\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0422\u041e\u041b\u042c\u041a\u041e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0436\u0438\u0432\u0451\u0442 \u0441\u0442\u0440\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d. \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c <code>FormContextService<\/code>, \u043d\u043e \u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438\u0437\u0432\u043d\u0435.<\/p>\n<pre><code class=\"typescript\">@Injectable() export class FormContextService {   private state = new BehaviorSubject&lt;any&gt;({});   get value$() {     return this.state.asObservable();   }    setValue(val: any) {     this.state.next(val);   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0432\u0435\u0441\u0438\u043c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442:<\/p>\n<pre><code class=\"typescript\">@Component({   selector: 'app-form',   providers: [FormContextService],   template: `     &lt;input (input)=\"update($event.target.value)\"&gt;     &lt;child-component&gt;&lt;\/child-component&gt;   ` }) export class FormComponent {   constructor(private ctx: FormContextService) {}    update(val: string) {     this.ctx.setValue({ input: val });   } }<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 <code>child-component<\/code>:<\/p>\n<pre><code class=\"typescript\">@Component({   selector: 'child-component',   template: `     &lt;p *ngIf=\"val$ | async as val\"&gt;{{ val.input }}&lt;\/p&gt;   ` }) export class ChildComponent {   val$ = this.ctx.value$;    constructor(private ctx: FormContextService) {} }<\/code><\/pre>\n<p>\u041e\u0431\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>FormContextService<\/code>, \u043d\u043e \u043e\u043d <strong>\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0443\u0440\u043e\u0432\u043d\u0435\u043c <\/strong><code><strong>FormComponent<\/strong><\/code>. \u0417\u0430 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0435\u0433\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435 \u2014 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0442\u0430\u0449\u0438\u0442\u044c <code>@SkipSelf<\/code> \u0438\u043b\u0438 <code>@Host<\/code>.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434<\/h3>\n<p>Angular \u0441\u0442\u0440\u043e\u0438\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0438\u0431\u043a\u0438\u0439, \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. DI \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0442\u044b\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 <strong>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong>.<\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0432\u044b\u0436\u0438\u043c\u043a\u0430:<\/p>\n<ul>\n<li>\n<p><code>providedIn: 'root'<\/code> = singleton \u043d\u0430 \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 = singleton \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 = \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442;<\/p>\n<\/li>\n<li>\n<p><code>@Optional<\/code> = \u043d\u0435 \u043f\u0430\u043d\u0438\u043a\u0443\u0439, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u0451\u043b;<\/p>\n<\/li>\n<li>\n<p><code>@SkipSelf<\/code> = \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438 \u0441\u0435\u0431\u044f, \u0438\u0434\u0438 \u0432\u0432\u0435\u0440\u0445;<\/p>\n<\/li>\n<li>\n<p><code>@Host<\/code> = \u043d\u0435 \u0432\u044b\u0448\u0435 \u0445\u043e\u0441\u0442\u0430 \u2014 \u043d\u0438 \u0448\u0430\u0433\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0438 \u043f\u0438\u0448\u0438\u0442\u0435 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u044f\u0445.<\/p>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0435\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Angular, \u0430\u00a0\u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a\u00a0\u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438\u00a0\u2014 \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441\u00a0\u043e\u0441\u043d\u043e\u0432 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Injector, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b @Optional, @SkipSelf \u0438 @Host, \u043a\u0430\u043a\u00a0\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432\u00a0\u2014 \u043e\u0431\u043e\u00a0\u0432\u0441\u0451\u043c \u044d\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0432\u00a0\u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>\u0410\u00a0\u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043e\u0442\u00a0\u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435\u00a0\u2014 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0443\u0440\u043e\u043a\u0438 \u043f\u043e\u00a0Angular \u0438 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u2011\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u00a0\u043b\u0438 \u0432\u0430\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/otus.pw\/MbdT\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0432\u00a0Angular\u00a0\u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u00a0\u043d\u0443\u043b\u044f<\/a>\u00a0\u2014 <em>10\u00a0\u0438\u044e\u043b\u044f \u0432 20:00 <\/em><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/otus.pw\/b6TP\/\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u00a0Angular<\/a>\u00a0\u2014 <em>24\u00a0\u0438\u044e\u043b\u044f \u0432 20:00 <\/em><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 <a href=\"https:\/\/otus.pw\/ap9z\/\" rel=\"noopener noreferrer nofollow\">\u0432\u0441\u0442\u0443\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a>\u00a0\u2014 \u0443\u0437\u043d\u0430\u0439\u0442\u0435, \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0438\u0445 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u0443\u0440\u0441\u0435 &#171;Angular Developer&#187;. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/923376\/\"> https:\/\/habr.com\/ru\/articles\/923376\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <code>Injector<\/code> \u0432 Angular, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u044b <code>@Optional<\/code>, <code>@SkipSelf<\/code>, <code>@Host<\/code>, \u0438 \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 <code>root<\/code>, \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. <\/p>\n<h3>\u041a\u0430\u043a Angular \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438: \u0430 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0434\u0451\u0442 \u0432\u0432\u0435\u0440\u0445<\/h3>\n<p>\u0412 Angular \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0433\u043e. Injector \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0449\u0435\u0442 \u0442\u0432\u043e\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445 \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443 \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u043e\u0432. <\/p>\n<pre><code>AppInjector (\u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f)   \u251c\u2500\u2500 ModuleInjector (\u0444\u0438\u0447\u0435\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438)   \u2502     \u2514\u2500\u2500 ComponentInjector (\u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442)   \u2502             \u2514\u2500\u2500 DirectiveInjector (\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b\/\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u0432\u043d\u0443\u0442\u0440\u0438)<\/code><\/pre>\n<p>Angular \u0441\u043c\u043e\u0442\u0440\u0438\u0442: \u201c\u0410\u0433\u0430, \u0442\u0443\u0442 \u0443 \u043c\u0435\u043d\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u041e\u043d \u0445\u043e\u0447\u0435\u0442 <code>MyService<\/code>. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044e, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043d\u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440. \u041d\u0435\u0442? \u041f\u043e\u0434\u043d\u0438\u043c\u0443\u0441\u044c \u0432\u044b\u0448\u0435 \u2014 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c. \u041d\u0435\u0442? \u0422\u043e\u0433\u0434\u0430 \u0432 AppModule. \u041d\u0430\u0448\u0451\u043b? \u041e\u043a\u0435\u0439, \u0432\u043e\u0442.\u201d<\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">@Injectable() export class LocalLogger {   log(msg: string) {     console.log('[LOCAL]', msg);   } }  @Component({   selector: 'logger-demo',   template: `&lt;p&gt;Check console&lt;\/p&gt;`,   providers: [LocalLogger] \/\/ \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 }) export class LoggerComponent {   constructor(logger: LocalLogger) {     logger.log('Hello from LoggerComponent');   } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>LocalLogger<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0438 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b\u0448\u0435 \u043f\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 <code>Logger<\/code>, \u044d\u0442\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u042d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443. \u0410 \u0432\u043e\u0442 \u0434\u0430\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e&#8230;<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 @Optional, @SkipSelf, @Host \u2014 \u043e\u0447\u0435\u043d\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u043a\u0438<\/h3>\n<h4>@Optional()<\/h4>\n<p>\u0415\u0441\u043b\u0438 Angular \u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442 \u043d\u0443\u0436\u043d\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u043e\u043d \u0431\u0440\u043e\u0441\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e: &#171;\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u2014 \u0445\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043d\u0435 \u0431\u0435\u0434\u0430&#187;. \u0412\u043e\u0442 \u0442\u043e\u0433\u0434\u0430 \u0438 \u043d\u0443\u0436\u0435\u043d <code>@Optional()<\/code>.<\/p>\n<pre><code class=\"typescript\">@Component({   selector: 'optional-demo',   template: `...`, }) export class OptionalComponent {   constructor(@Optional() private config?: OptionalConfigService) {     if (config) {       config.apply();     } else {       console.warn('No OptionalConfigService found. Using defaults.');     }   } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u043b\u0438 <code>OptionalConfigService<\/code> \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 <code>undefined<\/code>, \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u043f\u0430\u0434\u0451\u0442.<\/p>\n<h4>@SkipSelf()<\/h4>\n<p>\u0410 \u043e\u043d \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u201c\u0418\u0449\u0438, \u043d\u043e \u043d\u0435 \u0443 \u043c\u0435\u043d\u044f. \u042f \u2014 \u043d\u0435 \u0432 \u0441\u0447\u0451\u0442. \u041d\u0430\u0447\u0438\u043d\u0430\u0439 \u0441 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f.\u201d<\/p>\n<p>\u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u043a\u0435\u0439\u0441:<\/p>\n<pre><code class=\"typescript\">@Injectable() export class CoreService {}  @Component({   selector: 'child',   template: `...`,   providers: [CoreService] \/\/ \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c }) export class ChildComponent {   constructor(@SkipSelf() core: CoreService) {     \/\/ \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442 CoreService \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043d\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430   } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u043d\u0435 \u043f\u0435\u0440\u0435\u0431\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439.<\/p>\n<h4>@Host()<\/h4>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. <code>@Host()<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u201c\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0441\u044c \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430. \u0412\u044b\u0448\u0435 \u2014 \u043d\u0435 \u043b\u0435\u0437\u044c.\u201d<\/p>\n<pre><code class=\"typescript\">@Directive({   selector: '[track-host]', }) export class TrackHostDirective {   constructor(@Host() private logger: LocalLogger) {     \/\/ \u043d\u0430\u0439\u0434\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 LocalLogger \u0432 \u0445\u043e\u0441\u0442-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435, \u0433\u0434\u0435 \u043f\u043e\u0432\u0435\u0448\u0435\u043d\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430   } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0434\u043d\u0438\u043c \u0445\u043e\u0441\u0442\u043e\u043c. \u0412\u044b\u0440\u0443\u0447\u0430\u0435\u0442 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<h3>\u0423\u0440\u043e\u0432\u043d\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432<\/h3>\n<h4>providedIn: &#8216;root&#8217;<\/h4>\n<pre><code class=\"typescript\">@Injectable({ providedIn: 'root' }) export class ApiService {}<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u2014 &#171;\u0441\u043e\u0437\u0434\u0430\u0439 \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435&#187;. Singleton. \u0418 Angular \u043f\u043e\u0434\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 <code>AppInjector<\/code>.<\/p>\n<p>\u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <strong>\u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/strong>. <\/p>\n<h4>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435<\/h4>\n<pre><code class=\"typescript\">@NgModule({   providers: [AnalyticsService], }) export class AnalyticsModule {}<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <code>AnalyticsService<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u043d\u0430 \u0432\u0435\u0441\u044c \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u0437\u0430\u0441\u0430\u0434\u0430: \u0435\u0441\u043b\u0438 \u0442\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <strong>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437<\/strong> \u2014 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<h4>\u0412 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435<\/h4>\n<pre><code class=\"typescript\">@Component({   providers: [LocalStorageService], }) export class MyComponent {}<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u2014 \u0441\u0432\u043e\u044f \u043a\u043e\u043f\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0422\u041e\u041b\u042c\u041a\u041e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0436\u0438\u0432\u0451\u0442 \u0441\u0442\u0440\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d. \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c <code>FormContextService<\/code>, \u043d\u043e \u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438\u0437\u0432\u043d\u0435.<\/p>\n<pre><code class=\"typescript\">@Injectable() export class FormContextService {   private state = new BehaviorSubject&lt;any&gt;({});   get value$() {     return this.state.asObservable();   }    setValue(val: any) {     this.state.next(val);   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0432\u0435\u0441\u0438\u043c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442:<\/p>\n<pre><code class=\"typescript\">@Component({   selector: 'app-form',   providers: [FormContextService],   template: `     &lt;input (input)=\"update($event.target.value)\"&gt;     &lt;child-component&gt;&lt;\/child-component&gt;   ` }) export class FormComponent {   constructor(private ctx: FormContextService) {}    update(val: string) {     this.ctx.setValue({ input: val });   } }<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 <code>child-component<\/code>:<\/p>\n<pre><code class=\"typescript\">@Component({   selector: 'child-component',   template: `     &lt;p *ngIf=\"val$ | async as val\"&gt;{{ val.input }}&lt;\/p&gt;   ` }) export class ChildComponent {   val$ = this.ctx.value$;    constructor(private ctx: FormContextService) {} }<\/code><\/pre>\n<p>\u041e\u0431\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>FormContextService<\/code>, \u043d\u043e \u043e\u043d <strong>\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0443\u0440\u043e\u0432\u043d\u0435\u043c <\/strong><code><strong>FormComponent<\/strong><\/code>. \u0417\u0430 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0435\u0433\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435 \u2014 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0442\u0430\u0449\u0438\u0442\u044c <code>@SkipSelf<\/code> \u0438\u043b\u0438 <code>@Host<\/code>.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434<\/h3>\n<p>Angular \u0441\u0442\u0440\u043e\u0438\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0438\u0431\u043a\u0438\u0439, \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. DI \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0442\u044b\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 <strong>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong>.<\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0432\u044b\u0436\u0438\u043c\u043a\u0430:<\/p>\n<ul>\n<li>\n<p><code>providedIn: 'root'<\/code> = singleton \u043d\u0430 \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 = singleton \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 = \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442;<\/p>\n<\/li>\n<li>\n<p><code>@Optional<\/code> = \u043d\u0435 \u043f\u0430\u043d\u0438\u043a\u0443\u0439, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u0451\u043b;<\/p>\n<\/li>\n<li>\n<p><code>@SkipSelf<\/code> = \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438 \u0441\u0435\u0431\u044f, \u0438\u0434\u0438 \u0432\u0432\u0435\u0440\u0445;<\/p>\n<\/li>\n<li>\n<p><code>@Host<\/code> = \u043d\u0435 \u0432\u044b\u0448\u0435 \u0445\u043e\u0441\u0442\u0430 \u2014 \u043d\u0438 \u0448\u0430\u0433\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0438 \u043f\u0438\u0448\u0438\u0442\u0435 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u044f\u0445.<\/p>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0435\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Angular, \u0430\u00a0\u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a\u00a0\u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438\u00a0\u2014 \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441\u00a0\u043e\u0441\u043d\u043e\u0432 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Injector, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b @Optional, @SkipSelf \u0438 @Host, \u043a\u0430\u043a\u00a0\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432\u00a0\u2014 \u043e\u0431\u043e\u00a0\u0432\u0441\u0451\u043c \u044d\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0432\u00a0\u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>\u0410\u00a0\u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043e\u0442\u00a0\u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435\u00a0\u2014 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0443\u0440\u043e\u043a\u0438 \u043f\u043e\u00a0Angular \u0438 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u2011\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u00a0\u043b\u0438 \u0432\u0430\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/otus.pw\/MbdT\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0432\u00a0Angular\u00a0\u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u00a0\u043d\u0443\u043b\u044f<\/a>\u00a0\u2014 <em>10\u00a0\u0438\u044e\u043b\u044f \u0432 20:00 <\/em><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/otus.pw\/b6TP\/\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u00a0Angular<\/a>\u00a0\u2014 <em>24\u00a0\u0438\u044e\u043b\u044f \u0432 20:00 <\/em><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 <a href=\"https:\/\/otus.pw\/ap9z\/\" rel=\"noopener noreferrer nofollow\">\u0432\u0441\u0442\u0443\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a>\u00a0\u2014 \u0443\u0437\u043d\u0430\u0439\u0442\u0435, \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0438\u0445 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u0443\u0440\u0441\u0435 &#171;Angular Developer&#187;. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/923376\/\"> https:\/\/habr.com\/ru\/articles\/923376\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-465836","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/465836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=465836"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/465836\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=465836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=465836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=465836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}