diff --git a/package.json b/package.json index dae3442..2a47552 100644 --- a/package.json +++ b/package.json @@ -25,15 +25,15 @@ "@angular/platform-browser-dynamic": "4.0.3", "@angular/router": "4.0.3", "@angular/upgrade": "4.0.3", + "angular-in-memory-web-api": "^0.3.1", + "chart.js": "2.5.0", "core-js": "2.4.1", + "moment": "2.18.1", + "ng2-charts": "1.5.0", + "ngx-bootstrap": "1.6.6", "rxjs": "5.3.0", "ts-helpers": "1.1.2", - "zone.js": "0.8.8", - - "chart.js": "2.5.0", - "ngx-bootstrap": "1.6.6", - "ng2-charts": "1.5.0", - "moment": "2.18.1" + "zone.js": "0.8.8" }, "devDependencies": { "@angular/cli": "1.0.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 951ddea..c1cca0c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { LocationStrategy, HashLocationStrategy } from '@angular/common'; +import { HttpModule } from '@angular/http'; import { AppComponent } from './app.component'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; @@ -23,6 +24,7 @@ import { SimpleLayoutComponent } from './layouts/simple-layout.component'; imports: [ BrowserModule, AppRoutingModule, + HttpModule, BsDropdownModule.forRoot(), TabsModule.forRoot(), ChartsModule diff --git a/src/app/pages/register.component.ts b/src/app/pages/register.component.ts index 9f95537..59bce4e 100644 --- a/src/app/pages/register.component.ts +++ b/src/app/pages/register.component.ts @@ -1,10 +1,20 @@ import { Component } from '@angular/core'; +import { Http, Response } from '@angular/http'; +import 'rxjs/add/operator/map' @Component({ templateUrl: 'register.component.html' }) export class RegisterComponent { + private apiurl="https://dev.app.peartrade.org/api" + constructor(private http: Http) { + + this.getAges().subscribe( + result => {console.log(result)} +) } + getAges() { + return this.http.get(this.apiurl +'/info/ages' ).map((response: Response) => response.json()); + } - constructor() { } }