{"id":291075,"date":"2018-10-19T20:55:02","date_gmt":"2018-10-19T16:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291075"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291075","title":{"rendered":"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><i>\u0425\u043e\u0442\u044f \u043f\u0440\u043e\u0448\u043b\u0430\u044f \u043c\u043e\u044f <a href=\"https:\/\/habr.com\/post\/426935\/\">\u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f<\/a> \u0431\u044b\u043b\u0430 \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u0430 \u0440\u044f\u0434\u043e\u043c \u043b\u044e\u0434\u0435\u0439, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043a\u043b\u0435\u0439\u043c\u043e \u00ab\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u00bb. \u0427\u0442\u043e \u0431\u0435\u0437 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u043c\u043e\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u043c, \u043f\u043b\u0430\u0433\u0438\u0430\u0442\u043e\u043c. \u0412\u0435\u0434\u044c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043c\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043a\u043e\u0434\u0430.<\/i><\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c <b>\u0441\u0432\u043e\u044e<\/b> \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b \u0437\u0430\u043a\u0430\u0437 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0441\u043a\u0430\u0436\u0438\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0435\u0437\u0436\u0435\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. \u0415\u0441\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u044e\u0442 \u0441\u0430\u043c\u0438 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0438, \u0442\u043e \u0442\u0443\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0430\u043c \u0441\u0435\u0431\u0435 \u043f\u043e\u0434\u044b\u0441\u043a\u0430\u0442\u044c \u043a\u043e\u0447\u043a\u0438. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u043e\u0442\u043e\u0448\u0451\u043b \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432, \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438 \u0432\u0441\u044f\u043a\u0438\u0445 CMS \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 Single Page Application. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0440\u044f\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u0447\u0430\u0441\u0442\u044c\u044e \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0438 \u0438\u043c\u0435\u043b\u0430 \u0440\u044f\u0434 \u0442\u0430\u0431\u0443 \u0432 \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043d\u0435 \u0432\u043d\u0443\u0448\u0430\u043b\u043e \u043c\u043d\u0435 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430. \u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f. \u0421\u0443\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u0432\u0430\u0440\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0438 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439. \u0422\u0430\u043a \u0436\u0435, \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0431\u044b\u043b\u043e: \u043b\u0451\u0433\u043a\u043e\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0441\u0430\u043c\u0438\u043c \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u043c. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0430\u0439\u0442 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043d\u0438 \u043a\u0430\u043a SPA, \u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438, \u043c\u043d\u043e\u044e \u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e, Angular \u044f \u043d\u0435 \u043c\u043e\u0433\u0443\u2026 \u0438\u043b\u0438 \u043d\u0435\u0442? \u0414\u0430, \u043c\u043d\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a \u0441\u0430\u0439\u0442\u0443 \u0441\u0430\u043c fraemwork, \u043d\u043e \u044f \u043c\u043e\u0433 \u0441\u0434\u0435\u043b\u0430\u0442\u044c bundle \u0444\u0430\u0439\u043b \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u043c\u043d\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435, \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044f \u0431\u044b \u043d\u0435 \u0441\u0442\u0430\u043b \u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u044d\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0443. \u041c\u043d\u043e\u044e \u0434\u0432\u0438\u0433\u0430\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u044f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u042f \u0447\u0438\u0442\u0430\u043b \u043e \u043d\u0435\u043a\u043e\u043c CodeMix, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 Angular 6 \u0438 \u0432\u044b\u0448\u0435. \u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c, Angular Elements. \u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445 \u043e\u043d\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b HTML (+ JavaScript), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043d\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0440\u0430\u0437\u043d\u044b\u0445 fraemworks (\u0442\u043e\u0442 \u0436\u0435, React) \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 HTML + JavaScript!<\/p>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0430\u0437\u043d\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u0430\u043d\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e\u0434 \u043d\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, checkbox \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0437\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0430\u043d\u0435\u043b\u044c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0440\u0435\u0448\u0438\u0432 \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<p>  <b>\u041f\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0443 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/b><\/p>\n<ul>\n<li>Node.js,<\/li>\n<li>\u0414\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0443\u0437\u043b\u043e\u0432 (npm),<\/li>\n<li>Angular CLI (&gt; 6.0.0),<\/li>\n<li><a href=\"https:\/\/marketplace.eclipse.org\/content\/codemix\">CodeMix<\/a><\/li>\n<\/ul>\n<p>  <b>\u0412 Eclipse \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442.<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uh\/-d\/gu\/uh-dgu7beqhoyfbyxjw09un_0fe.png\"><br \/>  <i>File &gt; Create &gt; Project &gt; CodeMix &gt; Angular Project<\/i><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (<i>Ctrl+Shift+P<\/i>) <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ep\/xh\/p9\/epxhp9rwlfoorna5uty9jfzs_qo.png\"><br \/>  \u0412\u0432\u043e\u0434\u0438\u043c: <u>Terminal: Create New Integrated Terminal<\/u><\/p>\n<p>  \u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0412 \u043d\u0451\u043c \u043c\u044b \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c <i>npm install<\/i>, <i>ng serve<\/i>. \u041f\u043e\u0441\u043b\u0435, \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443: localhost:4200. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 Angular element \u0438 poly-fills \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u0434\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445 \u043e\u0442 Microsoft.<\/p>\n<p>  <code>npm install @angular\/elements @webcomponents\/custom-elements<\/code><\/p>\n<p>  <b>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/b><\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Angular CLI, \u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>  <code>ng g c codemix-example<\/code><\/p>\n<p>  \u041d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0433\u043e\u0442\u043e\u0432, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<p>  <b>HTML<\/b>:  <\/p>\n<pre><code class=\"xml\">&lt;div class=\"CodemixExampleComponentClass\"&gt;   &lt;div class=\"head\"&gt;     &lt;span&gt;{{ title }}&lt;\/span&gt;     &lt;input type=\"checkbox\" [checked]=\"isShow\" (change)=\"changeShow()\" \/&gt;   &lt;\/div&gt;   &lt;div class=\"body\" *ngIf=\"isShow\"&gt;{{ content }}&lt;\/div&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <b>TypeScript<\/b>:  <\/p>\n<pre><code>import { Component, Input, ViewEncapsulation } from '@angular\/core'; @Component({   selector: 'codemix-example',   templateUrl: '.\/codemix-example.component.html',   styleUrls: ['.\/codemix-example.component.css'],   encapsulation: ViewEncapsulation.Native }) export class CodemixExampleComponent {   public isShow: boolean;   constructor() { }    @Input() public content;   @Input() public title;      public changeShow(): void {     this.isShow = !this.isShow;   } }<\/code><\/pre>\n<p>  \u0412 \u0434\u0435\u0442\u0430\u043b\u0438 CSS \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0431\u043b\u043e\u043a\u0430\u043c \u0441\u0432\u043e\u0439 \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430.<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c. <\/p>\n<p>  \/\/app.module.ts.  <\/p>\n<pre><code>import { BrowserModule } from '@angular\/platform-browser'; import { NgModule, Injector } from '@angular\/core'; import { createCustomElement } from '@angular\/elements'; import { CodemixExampleComponent } from '.\/codemix-example\/codemix-example.component';  import { AppComponent } from '.\/app.component';  @NgModule({   declarations: [     AppComponent,     CodemixExampleComponent   ],   entryComponents: [CodemixExampleComponent],   imports: [     BrowserModule   ],   providers: [] }) export class AppModule {   constructor(private injector: Injector){ }      ngDoBootstrap(){     const element = createCustomElement(       CodemixExampleComponent, { injector: this.injector }     );     customElements.define('codemix-example', element)   } }<\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u0435 \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 Angular \u043e\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041c\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438 \u044d\u0442\u043e\u0433\u043e, \u0443\u0434\u0430\u043b\u0438\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e bootstrap \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 decorator \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0432 ngDoBootstrap \u043c\u0435\u0442\u043e\u0434 \u0432 AppModule \u043a\u043b\u0430\u0441\u0441\u0435. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 CodemixExampleComponent \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 entryComponents, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c Angular \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0417\u0430\u0442\u0435\u043c \u0432 ngDoBootstrap \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 CodemixExampleComponent \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 createCustomElement \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f Angular Elements. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 HTML-\u0444\u0430\u0439\u043b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, index.html \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; ... &lt;body&gt;   &lt;div style=\"width: 50vw; margin: auto;\"&gt;     &lt;codemix-example        title=\"Title text\"        content=\"Content text Content text  Content text Content text Content text Content text Content text Content text Content text Content text\"&gt;     &lt;\/codemix-example&gt;   &lt;\/div&gt; &lt;\/body&gt; ...<\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 bundle \u0444\u0430\u0439\u043b\u0430<\/b><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 HTML-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 bundle \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. <\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c concat:<br \/>  <code>npm install concat --save-dev<\/code><\/p>\n<p>  \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0430\u043f\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \/\/ build.js:  <\/p>\n<pre><code class=\"javascript\">const concat = require('concat'); const files = [    'node_modules\/@webcomponents\/custom-elements\/src\/native-shim.js',     '.\/dist\/angulartest\/runtime.js',     '.\/dist\/angulartest\/polyfills.js',     '.\/dist\/angulartest\/main.js' ];  const outputFile = '.\/dist\/bundle.js'; concat(files, outputFile);<\/code><\/pre>\n<p>  \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0442\u0440\u0438\u0445, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043d\u0443 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0451 \u0432 package.json \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 scripts:<br \/>  <code>ng build --prod --output-hashing = none &amp;&amp; node build-script.js<\/code><\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0439 bundle.js. \u0424\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 \u0434\u0440\u0443\u0433\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 HTML-\u0444\u0430\u0439\u043b \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0430\u043f\u043a\u0435.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2a\/ln\/r-\/2alnr-kmswkilnmvd79sghmdtgg.png\"><\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 index.html  <\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html lang=\"en\"&gt; &lt;head&gt;   &lt;meta charset=\"utf-8\"&gt;   &lt;title&gt;Angulartest&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;   &lt;div style=\"width: 50vw; margin: auto;\"&gt;     &lt;codemix-example        title=\"Title text\"        content=\"Content text Content text  Content text Content text Content text Content text Content text Content text Content text Content text\"&gt;     &lt;\/codemix-example&gt;   &lt;\/div&gt; &lt;script type=\"text\/javascript\" src=\"bundle.js\"&gt;&lt;\/script&gt; &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  <b>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 Angular \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c HTML-\u0444\u0430\u0439\u043b\u0435. \u0414\u0430, \u0437\u0434\u043e\u0440\u043e\u0432\u043e, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 Angular \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043e \u0441\u0435\u0431\u0435 \u0437\u0430\u044f\u0432\u0438\u0442\u044c. \u041c\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Angular, \u0432 React, Vue \u0438 \u0442.\u0434., \u043d\u0443 \u043d\u0435 \u043a\u0440\u0443\u0442\u043e \u043b\u0438? \u041d\u043e, \u043a\u0430\u043a \u044f \u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u044d\u0442\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438 \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u0447\u0442\u043e \u0440\u0435\u0448\u0430\u043b \u044f. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a. \u0412\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432. \u0410 \u0442\u0430\u043a \u0436\u0435 \u0432\u044b\u043d\u0443\u0436\u0434\u0430\u0435\u0442 \u043d\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0432 234\u041a\u0411.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/427075\/\"> https:\/\/habr.com\/post\/427075\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><i>\u0425\u043e\u0442\u044f \u043f\u0440\u043e\u0448\u043b\u0430\u044f \u043c\u043e\u044f <a href=\"https:\/\/habr.com\/post\/426935\/\">\u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f<\/a> \u0431\u044b\u043b\u0430 \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u0430 \u0440\u044f\u0434\u043e\u043c \u043b\u044e\u0434\u0435\u0439, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043a\u043b\u0435\u0439\u043c\u043e \u00ab\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u00bb. \u0427\u0442\u043e \u0431\u0435\u0437 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u043c\u043e\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u043c, \u043f\u043b\u0430\u0433\u0438\u0430\u0442\u043e\u043c. \u0412\u0435\u0434\u044c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043c\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043a\u043e\u0434\u0430.<\/i><\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c <b>\u0441\u0432\u043e\u044e<\/b> \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b \u0437\u0430\u043a\u0430\u0437 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430.   <\/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-291075","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291075","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=291075"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291075\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}