import { Component, OnInit } from '@angular/core'; import { ApiConfig } from '../shared/config/api.config'; import { RequestConfig, RestfulService } from '../shared/util/restful.service'; @Component({ moduleId: module.id, selector: 'stub-api', template: `

This is Stub Api sample page


login

{{loginJson | json}}

logout

{{logoutJson | json}}
` }) export class StubAPIComponent { loginJson: any; logoutJson: any; constructor( private api: ApiConfig, private rest: RestfulService ) { } login() { const request: RequestConfig = { url: this.api.getConfig('login.request') }; this.rest .request(request) .then((response: any) => this.loginJson = response); } logout() { const request: RequestConfig = { url: this.api.getConfig('logout.request') }; this.rest .request(request) .then((response: any) => this.logoutJson = response); } }