Skip to content

Commit

Permalink
Angular Material Course
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 15, 2017
1 parent a3dd8d7 commit bab632b
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 82 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config ./proxy.json",
"server": "./node_modules/.bin/ts-node ./server/server.ts",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
Expand Down
6 changes: 0 additions & 6 deletions proxy.json

This file was deleted.

13 changes: 0 additions & 13 deletions server/read-all-courses.route.ts

This file was deleted.

26 changes: 0 additions & 26 deletions server/server.ts

This file was deleted.

5 changes: 1 addition & 4 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {CoursesResolver} from "./services/courses.resolver";
const routes: Routes = [
{
path: "",
component: HomeComponent,
resolve: {
courses: CoursesResolver
}
component: HomeComponent

},
{
Expand Down
7 changes: 1 addition & 6 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {MatIconModule} from '@angular/material/icon';
import {MatCardModule} from '@angular/material/card';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import {HttpClientModule} from "@angular/common/http";
import {CoursesResolver} from "./services/courses.resolver";
import {MatTabsModule} from '@angular/material/tabs';

@NgModule({
Expand All @@ -23,17 +21,14 @@ import {MatTabsModule} from '@angular/material/tabs';
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
MatMenuModule,
MatButtonModule,
MatIconModule,
MatCardModule,
MatTabsModule,
AppRoutingModule
],
providers: [
CoursesResolver
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
Expand Down
4 changes: 3 additions & 1 deletion src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {ActivatedRoute} from "@angular/router";
import {Course} from "../model/course";
import {Observable} from "rxjs/Observable";
import {map, filter} from "rxjs/operators";
import {COURSES} from "../model/db-data";
import {of} from "rxjs/observable/of";

@Component({
selector: 'home',
Expand All @@ -21,7 +23,7 @@ export class HomeComponent implements OnInit {

ngOnInit() {

const courses$ = this.route.data.pipe(map( data => data['courses']));
const courses$ = of(Object.values(COURSES));

this.beginnerCourses$ = courses$.pipe(
map( courses => courses.filter(course => course.category === 'BEGINNER'))
Expand Down
File renamed without changes.
23 changes: 0 additions & 23 deletions src/app/services/courses.resolver.ts

This file was deleted.

3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
],
"lib": [
"es2017",
"dom"
"dom",
"ES2017.object"
]
}
}

0 comments on commit bab632b

Please sign in to comment.