File

src/lib/testing/src/mock-url-normalizer.ts

Index

Properties
Methods

Methods

getBaseHref
getBaseHref()
Returns : string
getLocation
getLocation()
Returns : LocationInfo
init
init(protocol: string, host: string, pathname: string, baseHref: string)
Parameters :
Name Type Optional Description
protocol string
host string
pathname string
baseHref string
Returns : this

Properties

internalBaseHref
internalBaseHref:
Default value : ''
internalHost
internalHost:
Default value : 'localhost'
internalPathname
internalPathname:
Default value : '/'
internalProtocol
internalProtocol:
Default value : 'http:'
import { Injectable } from '@angular/core';
import { BaseUrlNormalizer, LocationInfo } from 'angular-resource-router';

@Injectable()
export class MockUrlNormalizer extends BaseUrlNormalizer {

  internalProtocol = 'http:';
  internalHost = 'localhost';
  internalPathname = '/';
  internalBaseHref = '';

  init(protocol: string, host: string, pathname: string, baseHref: string) {
    this.internalProtocol = protocol;
    this.internalHost = host;
    this.internalPathname = pathname;
    this.internalBaseHref = baseHref;

    return this;
  }

  getBaseHref(): string {
    return this.internalBaseHref;
  }

  getLocation(): LocationInfo {
    return {
      protocol: this.internalProtocol,
      host: this.internalHost,
      pathname: this.internalPathname
    };
  }
}

results matching ""

    No results matching ""