File

src/app/services/navigation/navigation.service.ts

Description

Navigation service

Example

Index

Properties
Methods

Constructor

constructor(router: Router)

Constructor

Parameters :
Name Type Optional Description
router Router

Router

Methods

navigateTo
navigateTo(path: string)

Navigate to route

Parameters :
Name Type Optional Description
path string

Path

Returns : void

Properties

Private log
log:
Default value : Log.create('NavigationService')

Logger

import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Log } from 'ng2-logger';

/**
 * Navigation service
 * @author Danile Sogl
 */
@Injectable()
export class NavigationService {
  /** Logger */
  private log = Log.create('NavigationService');

  /**
   * Constructor
   * @param  {Router} router Router
   */
  constructor(private router: Router) {}

  /**
   * Navigate to route
   * @param  {string} path Path
   */
  navigateTo(path: string) {
    this.router.navigate([path]);
  }
}

results matching ""

    No results matching ""