Update TypeScript to do a better check for empty on basePath.

In Angular if a value is not defined for injection it is passed as
undefined. That means that most of the time `if (value) {` is a
reasonable test. Unfortunately since `""` (empty string) is also falsey
by nature, an empty string will not trigger the if properly.

Instead you should check `if (value !== undefined) {`.
This commit is contained in:
Andrew Z Allen 2016-05-09 22:59:25 -06:00
parent e17710fc72
commit 0b8c936972
4 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ namespace {{package}} {
static $inject: string[] = ['$http', '$httpParamSerializer'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}

View File

@ -12,7 +12,7 @@ namespace API.Client {
static $inject: string[] = ['$http', '$httpParamSerializer'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}

View File

@ -12,7 +12,7 @@ namespace API.Client {
static $inject: string[] = ['$http', '$httpParamSerializer'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}

View File

@ -12,7 +12,7 @@ namespace API.Client {
static $inject: string[] = ['$http', '$httpParamSerializer'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}