This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Entity } from '../enums'; | |
import { FleetPosition, Player } from '../models'; | |
import { StorageService } from './storage.service'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ApiService { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AuthService } from './auth.service'; | |
import { Injectable } from '@angular/core'; | |
import { | |
HttpRequest, HttpHandler, HttpInterceptor, HttpSentEvent, | |
HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpUserEvent | |
} from '@angular/common/http'; | |
import { Observable, BehaviorSubject, throwError} from 'rxjs'; | |
import { catchError, switchMap, finalize, filter, take, map } from 'rxjs/operators'; | |
import { Router } from '@angular/router'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AuthService } from './auth.service'; | |
import { Injectable } from '@angular/core'; | |
import { | |
HttpRequest, HttpHandler, HttpInterceptor, HttpSentEvent, | |
HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpUserEvent | |
} from '@angular/common/http'; | |
import { Observable, BehaviorSubject, throwError} from 'rxjs'; | |
import { catchError, switchMap, finalize, filter, take, map } from 'rxjs/operators'; | |
import { Router } from '@angular/router'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { | |
HttpRequest, | |
HttpHandler, | |
HttpEvent, | |
HttpInterceptor | |
} from '@angular/common/http'; | |
import { AuthService } from './auth/auth.service'; | |
import { Observable } from 'rxjs'; | |
// You can add URL which don't need AUTH header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { TokenInterceptor } from './../auth/token.interceptor'; | |
@NgModule({ | |
bootstrap: [AppComponent], | |
imports: [...], | |
providers: [ | |
{ | |
provide: HTTP_INTERCEPTORS, | |
useClass: TokenInterceptorService, | |
multi: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { | |
HttpRequest, | |
HttpHandler, | |
HttpEvent, | |
HttpInterceptor | |
} from '@angular/common/http'; | |
import { AuthService } from './auth/auth.service'; | |
import { Observable } from 'rxjs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpClient, HttpHeaders } from '@angular/common/http'; | |
import { map } from 'rxjs/operators'; | |
@Injectable() | |
export class AppService { | |
constructor(private http: HttpClient) { } | |
getCountries() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, Input, Host } from '@angular/core'; | |
import { TabsComponent } from '../tabs/tabs.component' | |
@Component({ | |
selector: 'tab', | |
template: ` | |
<div class="tab-pane" *ngIf="details.selected"> | |
<h4>{{details.title}}</h4> | |
<ng-content></ng-content> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'tabs', | |
template: ` | |
<div class="tabbable"> | |
<ul class="nav nav-tabs"> | |
<li *ngFor="let pane of panes" [ngClass]="{active:pane.selected}"> | |
<a href="#" (click)="select(pane)"> | |
{{pane.title}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.component('tabs', { | |
transclude: true, | |
controllerAs: 'tabs', | |
controller: [function TabsController() { | |
var tabs = this; | |
var panes = tabs.panes = [] | |
tabs.select = function(pane) { | |
angular.forEach(panes, function(p) { | |
p.selected = false; | |
}); |
NewerOlder