Bugfix/6727 import http client module (#6757)

* [angular-typescript] imports HttpClientModule

HttpModule has no effect, since the new `HttpClient` is now used. fixes #6727

* #6727: import http client module or http module, depending on setting

* #6727: import http client module or http module, depending on setting

* #6727: generate samples
This commit is contained in:
Esteban Marin 2017-10-25 04:53:20 +02:00 committed by wing328
parent 98e5612c84
commit f4ac6feae2
26 changed files with 56 additions and 3 deletions

View File

@ -1,6 +1,11 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
{{#useHttpClient}}
import { HttpClientModule } from '@angular/common/http';
{{/useHttpClient}}
{{^useHttpClient}}
import { HttpModule } from '@angular/http';
{{/useHttpClient}}
import { Configuration } from './configuration';
{{#apiInfo}}
@ -10,7 +15,7 @@ import { {{classname}} } from './{{importPath}}';
{{/apiInfo}}
@NgModule({
imports: [ CommonModule, HttpModule ],
imports: [ CommonModule, {{#useHttpClient}}HttpClientModule{{/useHttpClient}}{{^useHttpClient}}HttpModule{{/useHttpClient}} ],
declarations: [],
exports: [],
providers: [ {{#apiInfo}}{{#apis}}{{classname}}{{#hasMore}}, {{/hasMore}}{{/apis}}{{/apiInfo}} ]

View File

@ -19,3 +19,5 @@ export interface ApiResponse {
type?: string;
message?: string;
}

View File

@ -18,3 +18,5 @@ export interface Category {
id?: number;
name?: string;
}

View File

@ -33,3 +33,5 @@ export namespace Order {
Delivered: 'delivered' as StatusEnum
}
}

View File

@ -35,3 +35,5 @@ export namespace Pet {
Sold: 'sold' as StatusEnum
}
}

View File

@ -18,3 +18,5 @@ export interface Tag {
id?: number;
name?: string;
}

View File

@ -27,3 +27,5 @@ export interface User {
*/
userStatus?: number;
}

View File

@ -19,3 +19,5 @@ export interface ApiResponse {
type?: string;
message?: string;
}

View File

@ -18,3 +18,5 @@ export interface Category {
id?: number;
name?: string;
}

View File

@ -33,3 +33,5 @@ export namespace Order {
Delivered: 'delivered' as StatusEnum
}
}

View File

@ -35,3 +35,5 @@ export namespace Pet {
Sold: 'sold' as StatusEnum
}
}

View File

@ -18,3 +18,5 @@ export interface Tag {
id?: number;
name?: string;
}

View File

@ -27,3 +27,5 @@ export interface User {
*/
userStatus?: number;
}

View File

@ -18,3 +18,5 @@ export interface Category {
id?: number;
name?: string;
}

View File

@ -33,3 +33,5 @@ export namespace Order {
Delivered: 'delivered' as StatusEnum
}
}

View File

@ -35,3 +35,5 @@ export namespace Pet {
Sold: 'sold' as StatusEnum
}
}

View File

@ -18,3 +18,5 @@ export interface Tag {
id?: number;
name?: string;
}

View File

@ -27,3 +27,5 @@ export interface User {
*/
userStatus?: number;
}

View File

@ -19,3 +19,5 @@ export interface ApiResponse {
type?: string;
message?: string;
}

View File

@ -1,6 +1,6 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpModule } from '@angular/http';
import { HttpClientModule } from '@angular/common/http';
import { Configuration } from './configuration';
import { PetService } from './api/pet.service';
@ -8,7 +8,7 @@ import { StoreService } from './api/store.service';
import { UserService } from './api/user.service';
@NgModule({
imports: [ CommonModule, HttpModule ],
imports: [ CommonModule, HttpClientModule ],
declarations: [],
exports: [],
providers: [ PetService, StoreService, UserService ]

View File

@ -19,3 +19,5 @@ export interface ApiResponse {
type?: string;
message?: string;
}

View File

@ -18,3 +18,5 @@ export interface Category {
id?: number;
name?: string;
}

View File

@ -33,3 +33,5 @@ export namespace Order {
Delivered: 'delivered' as StatusEnum
}
}

View File

@ -35,3 +35,5 @@ export namespace Pet {
Sold: 'sold' as StatusEnum
}
}

View File

@ -18,3 +18,5 @@ export interface Tag {
id?: number;
name?: string;
}

View File

@ -27,3 +27,5 @@ export interface User {
*/
userStatus?: number;
}