This file contains hidden or 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
"scripts": [ | |
"node_modules/jquery/dist/jquery.min.js" | |
] |
This file contains hidden or 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
src |
This file contains hidden or 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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { ReactiveFormsModule } from '@angular/forms'; | |
import { AppComponent } from './app.component'; | |
@NgModule({ | |
declarations: [ |
This file contains hidden or 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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api'; | |
import { AppComponent } from './app.component'; | |
import { InMemoryDataService } from './services/in-memory-data.service'; | |
import { AuthInterceptor } from './shared/auth-interceptor'; | |
import { RockBand } from './services/rock-bands.service'; |
This file contains hidden or 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'; | |
import { RockBand } from './services/rock-bands.service'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<h2>List of Rock Bands that rocks!: </h2> | |
<ul> | |
<li *ngFor="let rockBand of rockBands"> | |
{{rockBand.id}} - {{rockBand.name}} |
This file contains hidden or 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 { HttpClient, HttpHeaders } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Injectable } from '@angular/core'; | |
@Injectable() | |
export class RockBand { | |
private rockBandsUrl = 'api/rockBands'; | |
constructor(private http: HttpClient) { | |
} |
This file contains hidden or 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 { InMemoryDbService } from 'angular-in-memory-web-api'; | |
export class InMemoryDataService implements InMemoryDbService { | |
createDb() { | |
const rockBands = [ | |
{ id: 1, name: 'The Beatles' }, | |
{ id: 2, name: 'Led Zeppelin' }, | |
{ id: 3, name: 'Pink Floyd' }, | |
{ id: 4, name: 'The Rolling Stones' }, | |
{ id: 5, name: 'Queen' }, |
This file contains hidden or 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 {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
@Injectable() | |
export class AuthInterceptor implements HttpInterceptor { | |
// constructor( INJECT YOUR AUTH SERVICE HERE ) | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { |