Skip to content

Commit 46585e6

Browse files
committed
HttpClientModule and HttpClientInMemoryWebApiModule import
1 parent 30e37c8 commit 46585e6

File tree

3 files changed

+74
-54
lines changed

3 files changed

+74
-54
lines changed

src/app/app.module.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1+
import { AppComponent } from './app.component';
12
import { BrowserModule } from '@angular/platform-browser';
3+
import { FormsModule } from '@angular/forms';
4+
import { HeroesComponent } from './heroes/heroes.component';
5+
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
6+
import { HttpClientModule } from '@angular/common/http';
7+
import { InMemoryDataService } from './in-memory-data.service';
28
import { NgModule } from '@angular/core';
3-
import {FormsModule} from '@angular/forms';
4-
import { AppComponent } from './app.component';
5-
69

710
@NgModule({
8-
declarations: [
9-
AppComponent,
10-
11-
],
12-
imports: [
13-
BrowserModule,
14-
15-
FormsModule,
16-
17-
],
18-
providers: [
19-
],
20-
bootstrap: [AppComponent]
11+
declarations: [AppComponent, HeroesComponent],
12+
imports: [
13+
BrowserModule,
14+
FormsModule,
15+
HttpClientModule,
16+
HttpClientInMemoryWebApiModule.forRoot(InMemoryDataService, {
17+
dataEncapsulation: false,
18+
passThruUnknownUrl: true,
19+
put204: false,
20+
}),
21+
],
22+
providers: [],
23+
bootstrap: [AppComponent],
2124
})
22-
export class AppModule { }
25+
export class AppModule {}

src/app/in-memory-data.service.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { InMemoryDbService } from 'angular-in-memory-web-api';
2+
3+
export class InMemoryDataService implements InMemoryDbService {
4+
createDb() {
5+
const heroesList = [
6+
{ id: 11, name: 'Dr Nice' },
7+
{ id: 12, name: 'Narco' },
8+
{ id: 13, name: 'Bombasto' },
9+
{ id: 14, name: 'Celeritas' },
10+
];
11+
return { heroesList };
12+
}
13+
}

src/styles.css

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,69 @@
11
/* Global Styles */
22
h1 {
3-
color: #369;
4-
font-family: Arial, Helvetica, sans-serif;
5-
font-size: 250%;
3+
color: #369;
4+
font-family: Arial, Helvetica, sans-serif;
5+
font-size: 250%;
66
}
7-
h2, h3 {
8-
color: #444;
9-
font-family: Arial, Helvetica, sans-serif;
10-
font-weight: lighter;
7+
h2,
8+
h3 {
9+
color: #444;
10+
font-family: Arial, Helvetica, sans-serif;
11+
font-weight: lighter;
1112
}
1213
body {
13-
margin: 2em;
14+
margin: 2em;
1415
}
15-
body, input[text], button {
16-
color: #333;
17-
font-family: Cambria, Georgia;
16+
body,
17+
input[text],
18+
button {
19+
color: #333;
20+
font-family: Cambria, Georgia;
1821
}
1922
a {
20-
cursor: pointer;
21-
cursor: hand;
23+
cursor: pointer;
24+
cursor: hand;
2225
}
2326
button {
24-
font-family: Arial;
25-
background-color: #eee;
26-
border: none;
27-
padding: 5px 10px;
28-
border-radius: 4px;
29-
cursor: pointer;
30-
cursor: hand;
27+
font-family: Arial;
28+
background-color: #eee;
29+
border: none;
30+
padding: 5px 10px;
31+
border-radius: 4px;
32+
cursor: pointer;
33+
cursor: hand;
3134
}
3235
button:hover {
33-
background-color: #cfd8dc;
36+
background-color: #cfd8dc;
3437
}
3538
button:disabled {
36-
background-color: #eee;
37-
color: #aaa;
38-
cursor: auto;
39+
background-color: #eee;
40+
color: #aaa;
41+
cursor: auto;
3942
}
4043

4144
/* Navigation link styles */
4245
nav a {
43-
padding: 5px 10px;
44-
text-decoration: none;
45-
margin-right: 10px;
46-
margin-top: 10px;
47-
display: inline-block;
48-
background-color: #eee;
49-
border-radius: 4px;
46+
padding: 5px 10px;
47+
text-decoration: none;
48+
margin-right: 10px;
49+
margin-top: 10px;
50+
display: inline-block;
51+
background-color: #eee;
52+
border-radius: 4px;
5053
}
51-
nav a:visited, a:link {
52-
color: #607D8B;
54+
nav a:visited,
55+
a:link {
56+
color: #607d8b;
5357
}
5458
nav a:hover {
55-
color: #039be5;
56-
background-color: #CFD8DC;
59+
color: #039be5;
60+
background-color: #cfd8dc;
5761
}
5862
nav a.active {
59-
color: #039be5;
63+
color: #039be5;
6064
}
6165

6266
/* everywhere else */
6367
* {
64-
font-family: Arial, Helvetica, sans-serif;
68+
font-family: Arial, Helvetica, sans-serif;
6569
}

0 commit comments

Comments
 (0)