{"id":474989,"date":"2025-09-14T21:01:00","date_gmt":"2025-09-14T21:01:00","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=474989"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=474989","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0438\u043d\u043f\u0443\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0441 ControlValueAccessor + NgControl\/Injector<\/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>\u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u044e\u0431\u043e\u0439 \u0437\u0440\u0435\u043b\u043e\u0439 \u0434\u0438\u0437\u0430\u0439\u043d-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0435\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043e \u0444\u043e\u0440\u043c\u0430\u0445, \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c, \u043e\u0442\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043e\u0442 \u043d\u0430\u0431\u043e\u0440\u0430 \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439\u00bb, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u00a0ControlValueAccessor.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 &#8212; \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u0435\u0449\u0451 \u043e\u0434\u043d\u043e API\u00bb. \u042d\u0442\u043e \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0448\u0438\u043c UI-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u043e\u0449\u043d\u0443\u044e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0443 Angular Forms, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/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 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u043f\u0443\u0442\u0430. \u041c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c CVA, \u043d\u043e \u0438 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c\u00a0NgControl\u00a0\u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430, \u0438\u0437\u0431\u0435\u0433\u0430\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u043e\u0432\u0443\u0448\u0435\u043a \u0432\u0440\u043e\u0434\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0426\u0435\u043b\u044c &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0432 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0445 enterprise-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c ControlValueAccessor (CVA)<\/h3>\n<p><code><strong>ControlValueAccessor<\/strong><\/code><strong> <\/strong>&#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043c\u0435\u0436\u0434\u0443 <strong>\u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u043e\u0439<\/strong> \u0438 <strong>\u0432\u0430\u0448\u0438\u043c UI-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u043c<\/strong>. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0435\u0433\u043e, \u0432\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c: \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044f\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, <code><strong>touched\/dirty\/disabled<\/strong><\/code>, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b, \u0435\u0434\u0438\u043d\u044b\u0439 DX.<\/p>\n<h3>NG_VALUE_ACCESSOR: \u043a\u0430\u043a \u00ab\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u00bb \u0432\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a \u0444\u043e\u0440\u043c\u0430\u043c<\/h3>\n<p>Angular \u0438\u0449\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440 \u0447\u0435\u0440\u0435\u0437 DI-\u0442\u043e\u043a\u0435\u043d <code><strong>NG_VALUE_ACCESSOR<\/strong><\/code>. \u0414\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0431\u044f:<\/p>\n<pre><code class=\"typescript\">providers: [{   provide: NG_VALUE_ACCESSOR,   useExisting: forwardRef(() =&gt; CustomInputComponent),   multi: true, }]<\/code><\/pre>\n<ul>\n<li>\n<p><code><strong>multi: true<\/strong><\/code> &#8212; \u0443 \u0442\u043e\u043a\u0435\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code><strong>useExisting<\/strong><\/code>&#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439<\/strong> \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0432 \u0440\u043e\u043b\u0438 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/strong> \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432\u00a0forwardRef\u00a0\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0435, \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0449\u0435\u043c CVA \u0438\u00a0NgControl, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u00a0\u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<h3>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 CVA &#8212; \u043a\u0440\u0430\u0442\u043a\u043e \u0438 \u043f\u043e \u0434\u0435\u043b\u0443<\/h3>\n<pre><code class=\"typescript\">interface ControlValueAccessor {   writeValue(obj: any): void;                   \/\/ \u043c\u043e\u0434\u0435\u043b\u044c -&gt; \u0432\u0438\u0434   registerOnChange(fn: any): void;              \/\/ \u0432\u0438\u0434 -&gt; \u043c\u043e\u0434\u0435\u043b\u044c (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435)   registerOnTouched(fn: any): void;             \/\/ \u0432\u0438\u0434 -&gt; \u043c\u043e\u0434\u0435\u043b\u044c (blur)   setDisabledState?(isDisabled: boolean): void; \/\/ disabled }<\/code><\/pre>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c NgControl \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430<\/h3>\n<p> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 (<code><strong>invalid<\/strong><\/code><strong>, <\/strong><code><strong>touched<\/strong><\/code><strong>, <\/strong><code><strong>dirty<\/strong><\/code><strong>, <\/strong><code><strong>errors<\/strong><\/code><strong>, <\/strong><code><strong>statusChanges<\/strong><\/code>) \u0436\u0438\u0432\u0443\u0442 \u0432 <code><strong>NgControl<\/strong><\/code>. \u0415\u0441\u043b\u0438 <strong>\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e <\/strong>\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <code><strong>NgControl<\/strong><\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <strong>\u043f\u0440\u044f\u043c\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435<\/strong><\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b\/ARIA-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0438\u0437\u0432\u043d\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0430\u0436\u043d\u043e: \u043f\u0440\u044f\u043c\u043e\u0439 \u0438\u043d\u0436\u0435\u043a\u0442 <code><strong>NgControl<\/strong><\/code>\u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c (NG200) \u0438 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u043d\u0435 \u0444\u043e\u0440\u043c, \u043f\u0440\u044f\u043c\u043e\u0439 \u0438\u043d\u0436\u0435\u043a\u0442 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f (\u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430). \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; \u0447\u0435\u0440\u0435\u0437 <code><strong>Injector.get<\/strong><\/code> \u0438 <code><strong>self: true<\/strong><\/code>: \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c <code><strong>NgControl<\/strong><\/code>\u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u0441\u0435\u0431\u044f, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442 &#8212; \u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f null.<\/p>\n<h3>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (Signals, OnPush, NgControl\/Injector)<\/h3>\n<pre><code class=\"typescript\">@Component({   selector: 'app-custom-input',   standalone: true,   imports: [CommonModule],   templateUrl: '.\/custom-input.component.html',   styleUrls: ['.\/custom-input.component.css'],   changeDetection: ChangeDetectionStrategy.OnPush,   providers: [{     provide: NG_VALUE_ACCESSOR,     useExisting: forwardRef(() =&gt; CustomInputComponent),     multi: true,   }], })  export class CustomInputComponent implements ControlValueAccessor, OnInit {   \/\/ \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API   public id = input&lt;string&gt;('custom-input');    public label = input.required&lt;string&gt;();   public type = input&lt;string&gt;('text');   public placeholder = input&lt;string&gt;('');   public value = signal&lt;string&gt;('');   public disabled = signal&lt;boolean&gt;(false);   \/\/ \u041a\u043e\u043b\u043b\u0431\u0435\u043a\u0438 \u043e\u0442 Angular Forms   public onChange: (value: string) =&gt; void = () =&gt; {};   public onTouched: () =&gt; void = () =&gt; {};   \/\/ \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e FormControl (\u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0435)   public ngControl: NgControl | null = null;   private injector = inject(Injector);   private inputEl = viewChild.required&lt;ElementRef&lt;HTMLInputElement&gt;&gt;('inputEl');    constructor() {      \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u044d\u0444\u0444\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u0441 DOM     effect(() =&gt;      if (this.inputEl()) {       this.inputEl().nativeElement.value = this.value();     });   }     public ngOnInit(): void {     \/\/ \u0411\u0435\u0440\u0451\u043c NgControl \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u0430;     \/\/ \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0435 - \u043f\u043e\u043b\u0443\u0447\u0438\u043c null     this.ngControl = this.injector.get(NgControl, null, { self: true });   }    public onInput(event: Event): void {     const newValue = (event.target as HTMLInputElement).value;     this.value.set(value);     this.onChange(newValue);   }    \/\/ ---- ControlValueAccessor ----   public writeValue(value: string): void {     this.value.set(value);   }    public registerOnChange(fn: (value: string) =&gt; void): void {     this.onChange = fn;   }    public registerOnTouched(fn: () =&gt; void): void {     this.onTouched = fn;   }    public setDisabledState(isDisabled: boolean): void {     this.disabled.set(isDisabled);   } }<\/code><\/pre>\n<h4>\u0448\u0430\u0431\u043b\u043e\u043d (\u0441 ARIA \u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438)<\/h4>\n<pre><code class=\"typescript\">&lt;div class=\"input-container\"&gt;   &lt;label [attr.for]=\"id()\"&gt;{{ label() }}&lt;\/label&gt;   &lt;input     #inputEl     [id]=\"id()\"     [type]=\"type()\"     [placeholder]=\"placeholder()\"     [disabled]=\"disabled()\"     (input)=\"onInput($event)\"     (blur)=\"onTouched()\"     [attr.aria-invalid]=\"ngControl?.invalid &amp;&amp; ngControl?.touched\"   \/&gt; &lt;\/div&gt;<\/code><\/pre>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435<\/h3>\n<pre><code class=\"typescript\">@Component({   selector: 'app-auth-form',   standalone: true,   imports: [ReactiveFormsModule, CustomInputComponent],   templateUrl: '.\/auth-form.component.html',   changeDetection: ChangeDetectionStrategy.OnPush, }) export class AuthFormComponent implements OnInit {   private fb = inject(FormBuilder);   public submittedData = signal&lt;any&gt;(null);    public customForm = this.fb.group({ \u00a0 \u00a0 username: this.fb.control('', { validators: [Validators.required, Validators.minLength(3)] }), \u00a0 \u00a0 email: this.fb.control('', { validators: [Validators.required, Validators.email] }),   });    public onSubmit(): void {     if (this.customForm.valid) {       this.submittedData.set(this.customForm.value);       console.log(this.customForm.value);     } else {       this.customForm.markAllAsTouched();     }   } }<\/code><\/pre>\n<pre><code class=\"typescript\">&lt;form [formGroup]=\"customForm\" (ngSubmit)=\"onSubmit()\"&gt;   &lt;app-custom-input     formControlName=\"username\"     label=\"Username\"     placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\"   \/&gt;    &lt;app-custom-input     formControlName=\"email\"     label=\"Email\"     type=\"email\"     placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b\"   \/&gt;    &lt;button type=\"submit\" [disabled]=\"customForm.invalid\"&gt;Submit&lt;\/button&gt; &lt;\/form&gt;  @if (submittedData()) {   &lt;div class=\"submitted\"&gt;     &lt;h3&gt;Submitted Data:&lt;\/h3&gt;     &lt;pre&gt;{{ submittedData() | json }}&lt;\/pre&gt;   &lt;\/div&gt; }<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb<\/h3>\n<ol>\n<li>\n<p><code>formControlName<\/code>\u0447\u0435\u0440\u0435\u0437 DI \u043d\u0430\u0445\u043e\u0434\u0438\u0442 value accessor\u2019\u044b \u043f\u043e <code>NG_VALUE_ACCESSOR<\/code>. \u041d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 &#8212; \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>Angular \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442<code>registerOnChange<\/code>\/<code>registerOnTouched<\/code>\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\/\u043f\u0430\u0442\u0447\u0430\u0445 \u0444\u043e\u0440\u043c\u044b Angular \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442<code>writeValue<\/code>, \u0430 \u043f\u0440\u0438 <code>disable\/enable<\/code> &#8212; <code>setDisabledState<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u2192 \u0432<code>onInput<\/code>\u043c\u044b \u0434\u0435\u0440\u0433\u0430\u0435\u043c<code>onChange(newValue)<\/code>\u2192 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>FormControl<\/code> \u2192 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b\/\u0441\u0442\u0430\u0442\u0443\u0441\u044b\/<code>valueChanges<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043c\u044b <strong>\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e<\/strong> \u0434\u043e\u0441\u0442\u0430\u043b\u0438 <code>NgControl<\/code> \u0447\u0435\u0440\u0435\u0437 <code>Injector.get(..., { self: true })<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f <code>aria-invalid<\/code>, \u043f\u043e\u043a\u0430\u0437\u0430 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<\/li>\n<\/ol>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<ul>\n<li>\n<p><strong>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/strong>: \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u0434\u043b\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0444\u043e\u0440\u043c, \u0435\u0434\u0438\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c (a11y).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/strong> \u0447\u0435\u0440\u0435\u0437 <code>NgControl<\/code>: \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 ARIA-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 UX-\u0441\u0438\u0433\u043d\u0430\u043b\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0441 Signals<\/strong>: \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u043e\u0434\u0430, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, OnPush \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0441\u0442\u044c<\/strong>: \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0441\u043a\u0438\/\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, <code>NG_VALIDATORS<\/code>, \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0438 \u0442.\u043f.<\/p>\n<\/li>\n<\/ul>\n<h3> \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p><code>ControlValueAccessor<\/code> \u0434\u0430\u0451\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u00ab\u0444\u043e\u0440\u043c\u0430 \u2194 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u00bb, \u0430 <code>NgControl + Injector<\/code> &#8212; \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c \u0431\u0435\u0437 \u0445\u0440\u0443\u043f\u043a\u0438\u0445 <strong>\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439<\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <strong>\u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439<\/strong> \u0438\u043d\u043f\u0443\u0442: \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439, \u0442\u0435\u0441\u0442\u043e\u043f\u0440\u0438\u0433\u043e\u0434\u043d\u044b\u0439 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e.<\/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\/946890\/\"> https:\/\/habr.com\/ru\/articles\/946890\/<\/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>\u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u044e\u0431\u043e\u0439 \u0437\u0440\u0435\u043b\u043e\u0439 \u0434\u0438\u0437\u0430\u0439\u043d-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0435\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043e \u0444\u043e\u0440\u043c\u0430\u0445, \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c, \u043e\u0442\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043e\u0442 \u043d\u0430\u0431\u043e\u0440\u0430 \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439\u00bb, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u00a0ControlValueAccessor.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 &#8212; \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u0435\u0449\u0451 \u043e\u0434\u043d\u043e API\u00bb. \u042d\u0442\u043e \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0448\u0438\u043c UI-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u043e\u0449\u043d\u0443\u044e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0443 Angular Forms, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/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 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u043f\u0443\u0442\u0430. \u041c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c CVA, \u043d\u043e \u0438 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c\u00a0NgControl\u00a0\u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430, \u0438\u0437\u0431\u0435\u0433\u0430\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u043e\u0432\u0443\u0448\u0435\u043a \u0432\u0440\u043e\u0434\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0426\u0435\u043b\u044c &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0432 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0445 enterprise-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c ControlValueAccessor (CVA)<\/h3>\n<p><code><strong>ControlValueAccessor<\/strong><\/code><strong> <\/strong>&#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043c\u0435\u0436\u0434\u0443 <strong>\u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u043e\u0439<\/strong> \u0438 <strong>\u0432\u0430\u0448\u0438\u043c UI-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u043c<\/strong>. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0435\u0433\u043e, \u0432\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c: \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044f\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, <code><strong>touched\/dirty\/disabled<\/strong><\/code>, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b, \u0435\u0434\u0438\u043d\u044b\u0439 DX.<\/p>\n<h3>NG_VALUE_ACCESSOR: \u043a\u0430\u043a \u00ab\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u00bb \u0432\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a \u0444\u043e\u0440\u043c\u0430\u043c<\/h3>\n<p>Angular \u0438\u0449\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440 \u0447\u0435\u0440\u0435\u0437 DI-\u0442\u043e\u043a\u0435\u043d <code><strong>NG_VALUE_ACCESSOR<\/strong><\/code>. \u0414\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0431\u044f:<\/p>\n<pre><code class=\"typescript\">providers: [{   provide: NG_VALUE_ACCESSOR,   useExisting: forwardRef(() =&gt; CustomInputComponent),   multi: true, }]<\/code><\/pre>\n<ul>\n<li>\n<p><code><strong>multi: true<\/strong><\/code> &#8212; \u0443 \u0442\u043e\u043a\u0435\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code><strong>useExisting<\/strong><\/code>&#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439<\/strong> \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0432 \u0440\u043e\u043b\u0438 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/strong> \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432\u00a0forwardRef\u00a0\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0435, \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0449\u0435\u043c CVA \u0438\u00a0NgControl, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u00a0\u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<h3>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 CVA &#8212; \u043a\u0440\u0430\u0442\u043a\u043e \u0438 \u043f\u043e \u0434\u0435\u043b\u0443<\/h3>\n<pre><code class=\"typescript\">interface ControlValueAccessor {   writeValue(obj: any): void;                   \/\/ \u043c\u043e\u0434\u0435\u043b\u044c -&gt; \u0432\u0438\u0434   registerOnChange(fn: any): void;              \/\/ \u0432\u0438\u0434 -&gt; \u043c\u043e\u0434\u0435\u043b\u044c (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435)   registerOnTouched(fn: any): void;             \/\/ \u0432\u0438\u0434 -&gt; \u043c\u043e\u0434\u0435\u043b\u044c (blur)   setDisabledState?(isDisabled: boolean): void; \/\/ disabled }<\/code><\/pre>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c NgControl \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430<\/h3>\n<p> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 (<code><strong>invalid<\/strong><\/code><strong>, <\/strong><code><strong>touched<\/strong><\/code><strong>, <\/strong><code><strong>dirty<\/strong><\/code><strong>, <\/strong><code><strong>errors<\/strong><\/code><strong>, <\/strong><code><strong>statusChanges<\/strong><\/code>) \u0436\u0438\u0432\u0443\u0442 \u0432 <code><strong>NgControl<\/strong><\/code>. \u0415\u0441\u043b\u0438 <strong>\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e <\/strong>\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <code><strong>NgControl<\/strong><\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <strong>\u043f\u0440\u044f\u043c\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435<\/strong><\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b\/ARIA-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0438\u0437\u0432\u043d\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0430\u0436\u043d\u043e: \u043f\u0440\u044f\u043c\u043e\u0439 \u0438\u043d\u0436\u0435\u043a\u0442 <code><strong>NgControl<\/strong><\/code>\u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c (NG200) \u0438 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u043d\u0435 \u0444\u043e\u0440\u043c, \u043f\u0440\u044f\u043c\u043e\u0439 \u0438\u043d\u0436\u0435\u043a\u0442 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f (\u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430). \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; \u0447\u0435\u0440\u0435\u0437 <code><strong>Injector.get<\/strong><\/code> \u0438 <code><strong>self: true<\/strong><\/code>: \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c <code><strong>NgControl<\/strong><\/code>\u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u0441\u0435\u0431\u044f, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442 &#8212; \u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f null.<\/p>\n<h3>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (Signals, OnPush, NgControl\/Injector)<\/h3>\n<pre><code class=\"typescript\">@Component({   selector: 'app-custom-input',   standalone: true,   imports: [CommonModule],   templateUrl: '.\/custom-input.component.html',   styleUrls: ['.\/custom-input.component.css'],   changeDetection: ChangeDetectionStrategy.OnPush,   providers: [{     provide: NG_VALUE_ACCESSOR,     useExisting: forwardRef(() =&gt; CustomInputComponent),     multi: true,   }], })  export class CustomInputComponent implements ControlValueAccessor, OnInit {   \/\/ \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API   public id = input&lt;string&gt;('custom-input');    public label = input.required&lt;string&gt;();   public type = input&lt;string&gt;('text');   public placeholder = input&lt;string&gt;('');   public value = signal&lt;string&gt;('');   public disabled = signal&lt;boolean&gt;(false);   \/\/ \u041a\u043e\u043b\u043b\u0431\u0435\u043a\u0438 \u043e\u0442 Angular Forms   public onChange: (value: string) =&gt; void = () =&gt; {};   public onTouched: () =&gt; void = () =&gt; {};   \/\/ \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e FormControl (\u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0435)   public ngControl: NgControl | null = null;   private injector = inject(Injector);   private inputEl = viewChild.required&lt;ElementRef&lt;HTMLInputElement&gt;&gt;('inputEl');    constructor() {      \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u044d\u0444\u0444\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u0441 DOM     effect(() =&gt;      if (this.inputEl()) {       this.inputEl().nativeElement.value = this.value();     });   }     public ngOnInit(): void {     \/\/ \u0411\u0435\u0440\u0451\u043c NgControl \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u0430;     \/\/ \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0435 - \u043f\u043e\u043b\u0443\u0447\u0438\u043c null     this.ngControl = this.injector.get(NgControl, null, { self: true });   }    public onInput(event: Event): void {     const newValue = (event.target as HTMLInputElement).value;     this.value.set(value);     this.onChange(newValue);   }    \/\/ ---- ControlValueAccessor ----   public writeValue(value: string): void {     this.value.set(value);   }    public registerOnChange(fn: (value: string) =&gt; void): void {     this.onChange = fn;   }    public registerOnTouched(fn: () =&gt; void): void {     this.onTouched = fn;   }    public setDisabledState(isDisabled: boolean): void {     this.disabled.set(isDisabled);   } }<\/code><\/pre>\n<h4>\u0448\u0430\u0431\u043b\u043e\u043d (\u0441 ARIA \u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438)<\/h4>\n<pre><code class=\"typescript\">&lt;div class=\"input-container\"&gt;   &lt;label [attr.for]=\"id()\"&gt;{{ label() }}&lt;\/label&gt;   &lt;input     #inputEl     [id]=\"id()\"     [type]=\"type()\"     [placeholder]=\"placeholder()\"     [disabled]=\"disabled()\"     (input)=\"onInput($event)\"     (blur)=\"onTouched()\"     [attr.aria-invalid]=\"ngControl?.invalid &amp;&amp; ngControl?.touched\"   \/&gt; &lt;\/div&gt;<\/code><\/pre>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435<\/h3>\n<pre><code class=\"typescript\">@Component({   selector: 'app-auth-form',   standalone: true,   imports: [ReactiveFormsModule, CustomInputComponent],   templateUrl: '.\/auth-form.component.html',   changeDetection: ChangeDetectionStrategy.OnPush, }) export class AuthFormComponent implements OnInit {   private fb = inject(FormBuilder);   public submittedData = signal&lt;any&gt;(null);    public customForm = this.fb.group({ \u00a0 \u00a0 username: this.fb.control('', { validators: [Validators.required, Validators.minLength(3)] }), \u00a0 \u00a0 email: this.fb.control('', { validators: [Validators.required, Validators.email] }),   });    public onSubmit(): void {     if (this.customForm.valid) {       this.submittedData.set(this.customForm.value);       console.log(this.customForm.value);     } else {       this.customForm.markAllAsTouched();     }   } }<\/code><\/pre>\n<pre><code class=\"typescript\">&lt;form [formGroup]=\"customForm\" (ngSubmit)=\"onSubmit()\"&gt;   &lt;app-custom-input     formControlName=\"username\"     label=\"Username\"     placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\"   \/&gt;    &lt;app-custom-input     formControlName=\"email\"     label=\"Email\"     type=\"email\"     placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b\"   \/&gt;    &lt;button type=\"submit\" [disabled]=\"customForm.invalid\"&gt;Submit&lt;\/button&gt; &lt;\/form&gt;  @if (submittedData()) {   &lt;div class=\"submitted\"&gt;     &lt;h3&gt;Submitted Data:&lt;\/h3&gt;     &lt;pre&gt;{{ submittedData() | json }}&lt;\/pre&gt;   &lt;\/div&gt; }<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb<\/h3>\n<ol>\n<li>\n<p><code>formControlName<\/code>\u0447\u0435\u0440\u0435\u0437 DI \u043d\u0430\u0445\u043e\u0434\u0438\u0442 value accessor\u2019\u044b \u043f\u043e <code>NG_VALUE_ACCESSOR<\/code>. \u041d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 &#8212; \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>Angular \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442<code>registerOnChange<\/code>\/<code>registerOnTouched<\/code>\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\/\u043f\u0430\u0442\u0447\u0430\u0445 \u0444\u043e\u0440\u043c\u044b Angular \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442<code>writeValue<\/code>, \u0430 \u043f\u0440\u0438 <code>disable\/enable<\/code> &#8212; <code>setDisabledState<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u2192 \u0432<code>onInput<\/code>\u043c\u044b \u0434\u0435\u0440\u0433\u0430\u0435\u043c<code>onChange(newValue)<\/code>\u2192 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>FormControl<\/code> \u2192 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b\/\u0441\u0442\u0430\u0442\u0443\u0441\u044b\/<code>valueChanges<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043c\u044b <strong>\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e<\/strong> \u0434\u043e\u0441\u0442\u0430\u043b\u0438 <code>NgControl<\/code> \u0447\u0435\u0440\u0435\u0437 <code>Injector.get(..., { self: true })<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f <code>aria-invalid<\/code>, \u043f\u043e\u043a\u0430\u0437\u0430 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<\/li>\n<\/ol>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<ul>\n<li>\n<p><strong>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/strong>: \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u0434\u043b\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0444\u043e\u0440\u043c, \u0435\u0434\u0438\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c (a11y).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/strong> \u0447\u0435\u0440\u0435\u0437 <code>NgControl<\/code>: \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 ARIA-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 UX-\u0441\u0438\u0433\u043d\u0430\u043b\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0441 Signals<\/strong>: \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u043e\u0434\u0430, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, OnPush \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0441\u0442\u044c<\/strong>: \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0441\u043a\u0438\/\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, <code>NG_VALIDATORS<\/code>, \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0438 \u0442.\u043f.<\/p>\n<\/li>\n<\/ul>\n<h3> \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p><code>ControlValueAccessor<\/code> \u0434\u0430\u0451\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u00ab\u0444\u043e\u0440\u043c\u0430 \u2194 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u00bb, \u0430 <code>NgControl + Injector<\/code> &#8212; \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c \u0431\u0435\u0437 \u0445\u0440\u0443\u043f\u043a\u0438\u0445 <strong>\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439<\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <strong>\u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439<\/strong> \u0438\u043d\u043f\u0443\u0442: \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439, \u0442\u0435\u0441\u0442\u043e\u043f\u0440\u0438\u0433\u043e\u0434\u043d\u044b\u0439 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e.<\/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\/946890\/\"> https:\/\/habr.com\/ru\/articles\/946890\/<\/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-474989","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/474989","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=474989"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/474989\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=474989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=474989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=474989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}