Added initial test http request
This commit is contained in:
parent
f3cc47396f
commit
66b3cd6ea4
3 changed files with 19 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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() { }
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue