{"id":334059,"date":"2022-06-05T21:00:30","date_gmt":"2022-06-05T21:00:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334059"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334059","title":{"rendered":"<span>Angular: ng-content \u0434\u043b\u044f ng-template<\/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<blockquote>\n<p>Macros are comparable with functions in regular programming languages. They are useful to reuse template fragments to not repeat yourself.<br \/>Macros are defined in regular templates.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/twig.symfony.com\/doc\/3.x\/tags\/macro.html\" rel=\"noopener noreferrer nofollow\">Twig 3.x documentation<\/a><\/p>\n<h2>\u0412 \u0447\u0451\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p><a href=\"https:\/\/angular.io\/guide\/content-projection\" rel=\"noopener noreferrer nofollow\">Content Projection<\/a> &#8212; \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0422\u0435\u043c\u0430 <a href=\"https:\/\/habr.com\/ru\/search\/?q=ng-content&amp;target_type=posts&amp;order=relevance\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e<\/a> \u0438 <a href=\"https:\/\/blog.angular-university.io\/angular-ng-content\/\" rel=\"noopener noreferrer nofollow\">\u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u0430<\/a> \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/indepth.dev\/posts\/1405\/ngtemplateoutlet\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445<\/a>. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0442\u0430\u043a\u043e\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"https:\/\/stackoverflow.com\/questions\/51948301\/using-ng-content-in-ng-template\/72507617#72507617\" rel=\"noopener noreferrer nofollow\">content projection \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 ng-template<\/a> \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0448\u0442\u0430\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043d\u044b, \u044d\u0442\u043e \u0438 \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u043e\u0432\u0441\u0435\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b c \u043b\u0438\u0445\u0432\u043e\u0439 \u0440\u0435\u0448\u0430\u044e\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443. \u041d\u043e, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0431\u044b\u0442\u044c \u0431\u043b\u0438\u0436\u0435 \u043a <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Don%E2%80%99t_repeat_yourself\" rel=\"noopener noreferrer nofollow\">DRY<\/a> \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u0442\u0435\u0445, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432 <a href=\"https:\/\/twig.symfony.com\/doc\/3.x\/tags\/macro.html\" rel=\"noopener noreferrer nofollow\">Twig<\/a>,  <a href=\"https:\/\/docs-python.ru\/packages\/modul-jinja2-python\/takoe-makrosy-shablonov-jinja2\/\" rel=\"noopener noreferrer nofollow\">Jinja2<\/a>, <a href=\"https:\/\/mozilla.github.io\/nunjucks\/templating.html#macro\" rel=\"noopener noreferrer nofollow\">Nunjucks<\/a> \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u043a\u0441\u0442\u0430\u0442\u0438.<\/p>\n<h2>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<pre><code class=\"xml\">&lt;ng-template #tpl1 let-param let-mark=\"mark\">   &lt;div>     &lt;ng-content>&lt;\/ng-content> &lt;!-- Not works here -->     &lt;ng-container *ngTemplateOutlet=\"param\">&lt;\/ng-container>       World {{mark}}           &lt;\/div> &lt;\/ng-template>  &lt;ng-template #paramTemplate1>   Hello  &lt;\/ng-template>  &lt;ng-template #paramTemplate2>   Hi &lt;\/ng-template>  &lt;ng-container *ngTemplateOutlet=\"tpl1; context: {$implicit: paramTemplate1, mark: '!'}\"> &lt;\/ng-container>      &lt;ng-container *ngTemplateOutlet=\"tpl1; context: {$implicit: paramTemplate2, mark: '!!!'}\"> &lt;\/ng-container><\/code><\/pre>\n<p>\u042d\u0442\u043e <a href=\"https:\/\/stackoverflow.com\/questions\/51948301\/using-ng-content-in-ng-template\/56958107#56958107\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 <\/a>\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0423 \u043d\u0435\u0433\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0438 \u0441 \u0435\u0451 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u043e\u0439. \u041b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 <a href=\"https:\/\/www.youtube.com\/watch?v=e-qDHM0slB0\" rel=\"noopener noreferrer nofollow\">\u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0442\u043e \u0447\u0442\u043e<\/a> \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u0438 \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0441\u0435\u0431\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"xml\"> &lt;ng-template #tpl21 let-ctx>          &lt;div>      &lt;ng-macro-content>&lt;\/ng-macro-content>       World {{ctx.mark}}           &lt;\/div>  &lt;\/ng-template>   &lt;ng-macro [template]=\"tpl21\" [context]=\"{ mark: '!' }\">    Hello  &lt;\/ng-macro>   &lt;ng-macro [template]=\"tpl21\" [context]=\"{ mark: '!!!' }\">    Hi  &lt;\/ng-macro><\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 <code>ng-macro<\/code> \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0437\u0430\u0445\u0432\u0430\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d (<code>TemplateRef<\/code>), \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0432 <a href=\"https:\/\/github.com\/angular\/angular\/blob\/ee98f4eaf844c84bbdbc93bad62fb574fa4c8589\/aio\/content\/guide\/glossary.md#view-hierarchy\" rel=\"noopener noreferrer nofollow\">\u0434\u0435\u0440\u0435\u0432\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a>\u0430 (\u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 <a href=\"https:\/\/angular.io\/guide\/hierarchical-dependency-injection\" rel=\"noopener noreferrer nofollow\">DI-\u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f<\/a>). \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435  <code>ng-macro-content<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0437\u0432\u043b\u0435\u0447\u044c, \u0438 \u043e\u0442\u0440\u0435\u0434\u0435\u0440\u0438\u0442\u044c. \u041f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0438\u0432\u0438\u043b\u044c\u043d\u043e, \u0430 \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0445\u0438\u0442\u0440\u0438\u0442\u044c, \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f  \u043a\u043b\u0430\u0441\u0441\u043e\u043c <a href=\"https:\/\/github.com\/angular\/angular\/blob\/3a60063a54d850c50ce962a8a39ce01cfee71398\/packages\/core\/src\/linker\/view_container_ref.ts\" rel=\"noopener noreferrer nofollow\">ViewContainerRef<\/a> , \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0431\u043b\u0430\u0433\u043e, \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0443\u0436\u043d\u043e\u0435 \u043d\u0430\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 <em>private<\/em> \u043f\u043e\u043b\u0435 <a href=\"https:\/\/github.com\/angular\/angular\/blob\/3a60063a54d850c50ce962a8a39ce01cfee71398\/packages\/core\/src\/linker\/view_container_ref.ts#L244\" rel=\"noopener noreferrer nofollow\">_hostLView<\/a> \u0442\u0438\u043f\u0430 <a href=\"https:\/\/github.com\/angular\/angular\/blob\/3a60063a54d850c50ce962a8a39ce01cfee71398\/packages\/core\/src\/render3\/interfaces\/view.ts#L81\" rel=\"noopener noreferrer nofollow\">LView<\/a>.<\/p>\n<p>\u041d\u043e\u0442\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u0433\u043e\u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u0447\u0438\u0442\u0430\u0435\u043c\u0430, \u043d\u043e \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0443\u0437\u043b\u043e\u0432 \u0432 <a href=\"https:\/\/learn.javascript.ru\/dom-nodes\" rel=\"noopener noreferrer nofollow\">DOM<\/a> \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/49e\/c1f\/1f3\/49ec1f1f3df251a6effb1972352e0c16.png\" alt=\"\" title=\"\" width=\"490\" height=\"310\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/49e\/c1f\/1f3\/49ec1f1f3df251a6effb1972352e0c16.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0442.\u0435. \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/angular.io\/guide\/structural-directives\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/a>:<\/p>\n<pre><code class=\"xml\">&lt;ng-template #tpl22 let-ctx>         &lt;div>     &lt;span *ngMacroContent>&lt;\/span>     World {{ctx.mark}}          &lt;\/div> &lt;\/ng-template>  &lt;ng-container *ngMacro=\"tpl22; context: { mark: '!' }\" >   Hello &lt;\/ng-container>  &lt;span *ngMacro=\"tpl22; context: { mark: '!!!' }\" >   Hi &lt;\/span><\/code><\/pre>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u0430\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0439 \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0435\u0439, \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e13\/547\/222\/e13547222b6492a1cfe721fff4c47cfd.png\" width=\"481\" height=\"315\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e13\/547\/222\/e13547222b6492a1cfe721fff4c47cfd.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1c3\/05f\/4ca\/1c305f4ca6a85b643abc62e0be792917.png\" width=\"413\" height=\"369\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1c3\/05f\/4ca\/1c305f4ca6a85b643abc62e0be792917.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e\u0435. \u041f\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443, \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u0430 \u0431\u044b\u0442\u044c \u0448\u0442\u0430\u0442\u043d\u043e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0430 \u0438 \u0435\u0441\u0442\u044c, \u043d\u043e \u044f \u043f\u0440\u043e \u043d\u0435\u0451 \u043d\u0435 \u0437\u043d\u0430\u044e). \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u043e\u0434\u0445\u043e\u0434 \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u0436\u0438\u0432\u0451\u0442 \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u0438 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 (\u0438\u043d\u043e\u0433\u0434\u0430, \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f). \u0412 \u0446\u0435\u043b\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0443\u0434\u043e\u0431\u043d\u043e. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, <code>ng-templat\u0435<\/code> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0432\u044b\u0441\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438, \u0442\u043e \u0431\u0443\u0434\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u0441\u043e\u0432\u0435\u0442.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 <a href=\"https:\/\/stackblitz.com\/edit\/ng-template-content?file=src%2Fmain.ts\" rel=\"noopener noreferrer nofollow\">StackBlitz<\/a> \u0434\u043b\u044f <a href=\"https:\/\/blog.angular.io\/angular-v14-is-now-available-391a6db736af\" rel=\"noopener noreferrer nofollow\">Angular 14<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/669656\/\"> https:\/\/habr.com\/ru\/post\/669656\/<\/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<blockquote>\n<p>Macros are comparable with functions in regular programming languages. They are useful to reuse template fragments to not repeat yourself.<br \/>Macros are defined in regular templates.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/twig.symfony.com\/doc\/3.x\/tags\/macro.html\" rel=\"noopener noreferrer nofollow\">Twig 3.x documentation<\/a><\/p>\n<h2>\u0412 \u0447\u0451\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p><a href=\"https:\/\/angular.io\/guide\/content-projection\" rel=\"noopener noreferrer nofollow\">Content Projection<\/a> &#8212; \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0422\u0435\u043c\u0430 <a href=\"https:\/\/habr.com\/ru\/search\/?q=ng-content&amp;target_type=posts&amp;order=relevance\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e<\/a> \u0438 <a href=\"https:\/\/blog.angular-university.io\/angular-ng-content\/\" rel=\"noopener noreferrer nofollow\">\u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u0430<\/a> \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/indepth.dev\/posts\/1405\/ngtemplateoutlet\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445<\/a>. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0442\u0430\u043a\u043e\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"https:\/\/stackoverflow.com\/questions\/51948301\/using-ng-content-in-ng-template\/72507617#72507617\" rel=\"noopener noreferrer nofollow\">content projection \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 ng-template<\/a> \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0448\u0442\u0430\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043d\u044b, \u044d\u0442\u043e \u0438 \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u043e\u0432\u0441\u0435\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b c \u043b\u0438\u0445\u0432\u043e\u0439 \u0440\u0435\u0448\u0430\u044e\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443. \u041d\u043e, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0431\u044b\u0442\u044c \u0431\u043b\u0438\u0436\u0435 \u043a <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Don%E2%80%99t_repeat_yourself\" rel=\"noopener noreferrer nofollow\">DRY<\/a> \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u0442\u0435\u0445, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432 <a href=\"https:\/\/twig.symfony.com\/doc\/3.x\/tags\/macro.html\" rel=\"noopener noreferrer nofollow\">Twig<\/a>,  <a href=\"https:\/\/docs-python.ru\/packages\/modul-jinja2-python\/takoe-makrosy-shablonov-jinja2\/\" rel=\"noopener noreferrer nofollow\">Jinja2<\/a>, <a href=\"https:\/\/mozilla.github.io\/nunjucks\/templating.html#macro\" rel=\"noopener noreferrer nofollow\">Nunjucks<\/a> \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u043a\u0441\u0442\u0430\u0442\u0438.<\/p>\n<h2>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<pre><code class=\"xml\">&lt;ng-template #tpl1 let-param let-mark=\"mark\">   &lt;div>     &lt;ng-content>&lt;\/ng-content> &lt;!-- Not works here -->     &lt;ng-container *ngTemplateOutlet=\"param\">&lt;\/ng-container>       World {{mark}}           &lt;\/div> &lt;\/ng-template>  &lt;ng-template #paramTemplate1>   Hello  &lt;\/ng-template>  &lt;ng-template #paramTemplate2>   Hi &lt;\/ng-template>  &lt;ng-container *ngTemplateOutlet=\"tpl1; context: {$implicit: paramTemplate1, mark: '!'}\"> &lt;\/ng-container>      &lt;ng-container *ngTemplateOutlet=\"tpl1; context: {$implicit: paramTemplate2, mark: '!!!'}\"> &lt;\/ng-container><\/code><\/pre>\n<p>\u042d\u0442\u043e <a href=\"https:\/\/stackoverflow.com\/questions\/51948301\/using-ng-content-in-ng-template\/56958107#56958107\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 <\/a>\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0423 \u043d\u0435\u0433\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0438 \u0441 \u0435\u0451 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u043e\u0439. \u041b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 <a href=\"https:\/\/www.youtube.com\/watch?v=e-qDHM0slB0\" rel=\"noopener noreferrer nofollow\">\u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0442\u043e \u0447\u0442\u043e<\/a> \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u0438 \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0441\u0435\u0431\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"xml\"> &lt;ng-template #tpl21 let-ctx>          &lt;div>      &lt;ng-macro-content>&lt;\/ng-macro-content>       World {{ctx.mark}}           &lt;\/div>  &lt;\/ng-template>   &lt;ng-macro [template]=\"tpl21\" [context]=\"{ mark: '!' }\">    Hello  &lt;\/ng-macro>   &lt;ng-macro [template]=\"tpl21\" [context]=\"{ mark: '!!!' }\">    Hi  &lt;\/ng-macro><\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 <code>ng-macro<\/code> \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0437\u0430\u0445\u0432\u0430\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d (<code>TemplateRef<\/code>), \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0432 <a href=\"https:\/\/github.com\/angular\/angular\/blob\/ee98f4eaf844c84bbdbc93bad62fb574fa4c8589\/aio\/content\/guide\/glossary.md#view-hierarchy\" rel=\"noopener noreferrer nofollow\">\u0434\u0435\u0440\u0435\u0432\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a>\u0430 (\u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 <a href=\"https:\/\/angular.io\/guide\/hierarchical-dependency-injection\" rel=\"noopener noreferrer nofollow\">DI-\u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f<\/a>). \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435  <code>ng-macro-content<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0437\u0432\u043b\u0435\u0447\u044c, \u0438 \u043e\u0442\u0440\u0435\u0434\u0435\u0440\u0438\u0442\u044c. \u041f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0438\u0432\u0438\u043b\u044c\u043d\u043e, \u0430 \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0445\u0438\u0442\u0440\u0438\u0442\u044c, \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f  \u043a\u043b\u0430\u0441\u0441\u043e\u043c <a href=\"https:\/\/github.com\/angular\/angular\/blob\/3a60063a54d850c50ce962a8a39ce01cfee71398\/packages\/core\/src\/linker\/view_container_ref.ts\" rel=\"noopener noreferrer nofollow\">ViewContainerRef<\/a> , \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0431\u043b\u0430\u0433\u043e, \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0443\u0436\u043d\u043e\u0435 \u043d\u0430\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 <em>private<\/em> \u043f\u043e\u043b\u0435 <a href=\"https:\/\/github.com\/angular\/angular\/blob\/3a60063a54d850c50ce962a8a39ce01cfee71398\/packages\/core\/src\/linker\/view_container_ref.ts#L244\" rel=\"noopener noreferrer nofollow\">_hostLView<\/a> \u0442\u0438\u043f\u0430 <a href=\"https:\/\/github.com\/angular\/angular\/blob\/3a60063a54d850c50ce962a8a39ce01cfee71398\/packages\/core\/src\/render3\/interfaces\/view.ts#L81\" rel=\"noopener noreferrer nofollow\">LView<\/a>.<\/p>\n<p>\u041d\u043e\u0442\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u0433\u043e\u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u0447\u0438\u0442\u0430\u0435\u043c\u0430, \u043d\u043e \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0443\u0437\u043b\u043e\u0432 \u0432 <a href=\"https:\/\/learn.javascript.ru\/dom-nodes\" rel=\"noopener noreferrer nofollow\">DOM<\/a> \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0442.\u0435. \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/angular.io\/guide\/structural-directives\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/a>:<\/p>\n<pre><code class=\"xml\">&lt;ng-template #tpl22 let-ctx>         &lt;div>     &lt;span *ngMacroContent>&lt;\/span>     World {{ctx.mark}}          &lt;\/div> &lt;\/ng-template>  &lt;ng-container *ngMacro=\"tpl22; context: { mark: '!' }\" >   Hello &lt;\/ng-container>  &lt;span *ngMacro=\"tpl22; context: { mark: '!!!' }\" >   Hi &lt;\/span><\/code><\/pre>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u0430\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0439 \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0435\u0439, \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e\u0435. \u041f\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443, \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u0430 \u0431\u044b\u0442\u044c \u0448\u0442\u0430\u0442\u043d\u043e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0430 \u0438 \u0435\u0441\u0442\u044c, \u043d\u043e \u044f \u043f\u0440\u043e \u043d\u0435\u0451 \u043d\u0435 \u0437\u043d\u0430\u044e). \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u043e\u0434\u0445\u043e\u0434 \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u0436\u0438\u0432\u0451\u0442 \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u0438 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 (\u0438\u043d\u043e\u0433\u0434\u0430, \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f). \u0412 \u0446\u0435\u043b\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0443\u0434\u043e\u0431\u043d\u043e. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, <code>ng-templat\u0435<\/code> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0432\u044b\u0441\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438, \u0442\u043e \u0431\u0443\u0434\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u0441\u043e\u0432\u0435\u0442.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 <a href=\"https:\/\/stackblitz.com\/edit\/ng-template-content?file=src%2Fmain.ts\" rel=\"noopener noreferrer nofollow\">StackBlitz<\/a> \u0434\u043b\u044f <a href=\"https:\/\/blog.angular.io\/angular-v14-is-now-available-391a6db736af\" rel=\"noopener noreferrer nofollow\">Angular 14<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/669656\/\"> https:\/\/habr.com\/ru\/post\/669656\/<\/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-334059","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334059","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=334059"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334059\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}