{"id":287409,"date":"2018-08-16T14:08:36","date_gmt":"2018-08-16T10:08:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287409"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2018-08-16T10:08:36","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287409","title":{"rendered":"\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e Github \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Angular"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419933\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dd\/nw\/h7\/ddnwh7z-1a7jelysh0trhcixm5y.png\" alt=\"image\"><\/p>\n<p>  <b>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0430:<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/post\/419559\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e GitHub \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f React + RxJS 6 + Recompose<\/a>,<\/li>\n<li><a href=\"https:\/\/habr.com\/post\/419653\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e GitHub \u0431\u0435\u0437 React + RxJS 6 + Recompose<\/a>,<\/li>\n<li><a href=\"https:\/\/habr.com\/post\/419893\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e Github \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f VanillaJS<\/a>.<\/li>\n<\/ul>\n<p>  <b>\u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/b><\/p>\n<ul>\n<li>\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 Angular \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043d\u0435 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0435\u043a,<\/li>\n<li>\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043b\u044e\u0441\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Angular.<\/li>\n<\/ul>\n<p>  <b>\u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u041d\u0415 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/b><\/p>\n<ul>\n<li>\u0440\u0430\u0437\u0436\u0438\u0433\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0445\u043e\u043b\u0438\u0432\u0430\u0440\u0430.<\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h2>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <a href=\"https:\/\/angular.io\/\">Angular<\/a> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e <a href=\"https:\/\/cli.angular.io\/\">angular CLI<\/a><\/p>\n<pre><code>npm install -g @angular\/cli<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435  <\/p>\n<pre><code>ng new github-ui cd github-ui <\/code><\/pre>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043e\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 github<\/p>\n<pre><code>ng generate component components\/user ng generate component components\/error ng generate service services\/github <\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0438\u0445 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u0422\u0430\u043a-\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0438 <a href=\"https:\/\/angular.io\/guide\/http\">HttpClient<\/a> (\u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438) \u0438 <a href=\"https:\/\/angular.io\/guide\/reactive-forms\">ReactiveForms<\/a> (\u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438).<\/p>\n<p>  <b>app.module.ts<\/b><\/p>\n<pre><code>import { BrowserModule } from '@angular\/platform-browser'; import { NgModule } from '@angular\/core'; import { ReactiveFormsModule } from '@angular\/forms'; import { HttpClient } from '@angular\/common\/http';  import { AppComponent } from '.\/app.component'; import { UserComponent } from '.\/components\/user\/user.component'; import { ErrorComponent } from '.\/components\/error\/error.component'; import { GithubService } from '.\/services\/github.service';  @NgModule({   declarations: [AppComponent, UserComponent, ErrorComponent],   imports: [BrowserModule, ReactiveFormsModule, HttpClient],   providers: [GithubService],   bootstrap: [AppComponent] }) export class AppModule {} <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  \u0422.\u043a. Angular \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"http:\/\/www.typescriptlang.org\/\">Typescript<\/a>, \u0430 Typescript \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e, \u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>  \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043b\u044e\u0441\u044b:<\/p>\n<ul>\n<li>\u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043a\u043e\u043c\u043f\u043b\u0438\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c,<\/li>\n<li>\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438,<\/li>\n<li>\u0434\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442.<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">models\/user.model.ts<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>export class User {   login: string;   id: number;   node_id: string;   avatar_url: string;   gravatar_id: string;   url: string;   html_url: string;   followers_url: string;   following_url: string;   gists_url: string;   starred_url: string;   subscriptions_url: string;   organizations_url: string;   repos_url: string;   events_url: string;   received_events_url: string;   type: string;   site_admin: boolean;   name: string;   company: string;   blog: string;   location: string;   email: string;   hireable: string;   bio: string;   public_repos: number;   public_gists: number;   followers: number;   following: number;   created_at: string;   updated_at: string; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0443 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 Angular \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0432 <a href=\"https:\/\/angular.io\/tutorial\/toh-pt4\">\u0441\u0435\u0440\u0432\u0438\u0441\u044b<\/a>.<\/p>\n<p>  \u0412 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <b>services\/github.service.ts<\/b><\/p>\n<pre><code>import { Injectable } from '@angular\/core'; import { HttpClient } from '@angular\/common\/http'; import { Observable } from 'rxjs'; import { User } from '..\/models\/user.model';  @Injectable() export class GithubService {    \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 http   constructor(private http: HttpClient) {}    \/\/ \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   getUser(name: string): Observable&lt;User&gt; {     const url = `https:\/\/api.github.com\/users\/${name}`;     return this.http.get&lt;User&gt;(url);   } } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>  \u0412 Angular \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d <a href=\"http:\/\/reactivex.io\/rxjs\/class\/es6\/Observable.js~Observable.html\">RxJs<\/a>. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/p>\n<p>  <b>app.component.html<\/b><\/p>\n<pre><code class=\"markdown\">&lt;div class=\"container\"   [class.ready]=\"!!user\"&gt;   &lt;input [formControl]=\"findControl\"     placeholder=\"GitHub username\" \/&gt;    &lt;app-user *ngIf=\"user\"     [user]=\"user\"&gt;&lt;\/app-user&gt;    &lt;app-error *ngIf=\"error\"&gt;&lt;\/app-error&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  <b>app.component.ts<\/b><\/p>\n<pre><code>import { Component, OnInit } from '@angular\/core'; import { FormControl } from '@angular\/forms'; import { GithubService } from '.\/services\/github.service'; import { User } from '.\/models\/user.model'; import { filter, switchMap, debounceTime, catchError } from 'rxjs\/operators'; import { EMPTY } from 'rxjs';  @Component({   selector: 'app-root',   templateUrl: '.\/app.component.html',   styleUrls: ['.\/app.component.css'] }) export class AppComponent implements OnInit {   \/\/ \u041a\u043e\u043d\u0442\u0440\u043e\u043b \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439   findControl = new FormControl();   \/\/ \u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430   error: boolean = false;   \/\/ \u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c   user: User = null;    \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 githubService \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   constructor(private githubService: GithubService) {}    \/\/ \u0425\u0443\u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430   ngOnInit() {     this.findControl.valueChanges       .pipe(         \/\/ \u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432         filter(value =&gt; value.length &gt; 2),         \/\/ \u0421\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u043e\u0434\u043d\u0443 \u0441\u0435\u043a\u0443\u043d\u0434\u0443         debounceTime(1000),         \/\/ \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f         switchMap(value =&gt;           this.githubService.getUser(value).pipe(             \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a             catchError(err =&gt; {               this.user = null;               this.error = true;               return EMPTY;             })           )         )       )       \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445       .subscribe(user =&gt; {         this.user = user;         this.error = false;       });   } } <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b<\/h2>\n<p>  \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u00ab\u0433\u043b\u0443\u043f\u044b\u043c\u0438\u00bb, \u0442.\u0435. \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043b\u043e\u0433\u0438\u043a\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">user component<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"markdown\">&lt;div class=\"github-card user-card\"&gt;   &lt;div class=\"header User\"&gt;&lt;\/div&gt;   &lt;a class=\"avatar\"     [href]=\"'https:\/\/github.com\/'+user.login\"&gt;       &lt;img [src]=\"user.avatar_url+'&amp;s=80'\" [alt]=\"user.name\" \/&gt;     &lt;\/a&gt;   &lt;div class=\"content\"&gt;     &lt;h1&gt;{{user.name}}&lt;\/h1&gt;     &lt;ul class=\"status\"&gt;       &lt;li&gt;         &lt;a [href]=\"'https:\/\/github.com\/'+user.login+'?tab=repositories'\"&gt;             &lt;strong&gt;{{user.public_repos}}&lt;\/strong&gt;Repos           &lt;\/a&gt;       &lt;\/li&gt;       &lt;li&gt;         &lt;a [href]=\"'https:\/\/gist.github.com\/'+user.login\"&gt;             &lt;strong&gt;{{user.public_gists}}&lt;\/strong&gt;Gists           &lt;\/a&gt;       &lt;\/li&gt;       &lt;li&gt;         &lt;a [href]=\"'https:\/\/github.com\/'+user.login+'\/followers'\"&gt;             &lt;strong&gt;{{user.followers}}&lt;\/strong&gt;Followers           &lt;\/a&gt;       &lt;\/li&gt;     &lt;\/ul&gt;   &lt;\/div&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code>import { Component, Input, ChangeDetectionStrategy } from '@angular\/core'; import { User } from '..\/..\/models\/user.model';  @Component({   selector: 'app-user',   templateUrl: '.\/user.component.html',   styleUrls: ['.\/user.component.css'],   changeDetection: ChangeDetectionStrategy.OnPush }) export class UserComponent {   @Input()   user: User; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">error component<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"markdown\">&lt;div class=\"error\"&gt;   &lt;h2&gt;Oops!&lt;\/h2&gt;   &lt;b&gt;     User not found.   &lt;\/b&gt;   &lt;p&gt;Please try searching again.&lt;\/p&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code>import { Component, OnInit, ChangeDetectionStrategy } from '@angular\/core';  @Component({   selector: 'app-error',   templateUrl: '.\/error.component.html',   styleUrls: ['.\/error.component.css'],   changeDetection: ChangeDetectionStrategy.OnPush }) export class ErrorComponent {} <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u043b\u044e\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Angular<\/h3>\n<p>  <\/p>\n<ul>\n<li>\u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438,<\/li>\n<li>\u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043e\u0442 \u043b\u043e\u0433\u0438\u043a\u0438,<\/li>\n<li>\u0447\u0435\u0442\u043a\u0430\u044f \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430,<\/li>\n<li>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c,<\/li>\n<li>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 RxJs \u0434\u043b\u044f \u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b,<\/li>\n<li>\u0441\u0442\u0440\u043e\u0433\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/h3>\n<p>  <a href=\"https:\/\/github.com\/klimentru1986\/github-ui-angular\">github<\/a><br \/>  <a href=\"https:\/\/stackblitz.com\/github\/klimentru1986\/github-ui-angular\">live demo<\/a><\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>  \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435 \u043b\u044e\u0431\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435) \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438\u043b\u0438 <a href=\"http:\/\/vanilla-js.com\/\">\u0447\u0438\u0441\u0442\u044b\u0439 JS<\/a>.<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435, \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0412\u0441\u0435\u043c \u0443\u0441\u043f\u0435\u0445\u043e\u0432 \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0438 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430!<\/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\/419933\/\"> https:\/\/habr.com\/post\/419933\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419933\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dd\/nw\/h7\/ddnwh7z-1a7jelysh0trhcixm5y.png\" alt=\"image\"><\/p>\n<p>  <b>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0430:<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/post\/419559\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e GitHub \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f React + RxJS 6 + Recompose<\/a>,<\/li>\n<li><a href=\"https:\/\/habr.com\/post\/419653\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e GitHub \u0431\u0435\u0437 React + RxJS 6 + Recompose<\/a>,<\/li>\n<li><a href=\"https:\/\/habr.com\/post\/419893\/\">\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e Github \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f VanillaJS<\/a>.<\/li>\n<\/ul>\n<p>  <b>\u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/b><\/p>\n<ul>\n<li>\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 Angular \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043d\u0435 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0435\u043a,<\/li>\n<li>\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043b\u044e\u0441\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Angular.<\/li>\n<\/ul>\n<p>  <b>\u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u041d\u0415 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/b><\/p>\n<ul>\n<li>\u0440\u0430\u0437\u0436\u0438\u0433\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0445\u043e\u043b\u0438\u0432\u0430\u0440\u0430.<\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/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-287409","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287409","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=287409"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287409\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}