0

ich in Not bin einer Go-Back-Taste für diesen I Standortdienste sind mit geben, wie:Angular2 location.back() Seite neu geladen?

import {Location} from '@angular/common'; 

backclicked(): void 
{ 
    console.log("back clicked."); 
    this.location.back(); 
} 

<a id="redirect-link" (click)="backclicked();" style="padding:8px 15px;" > 

Ausgabe ist dies, dass location.back() funktioniert, aber mit Seitenlast. So ist es ein Weg, wo es ohne Seitenladung erreicht werden kann. Irgendwelche Hilfe bitte?

Antwort

2

Sie können den eingebauten Ortungsdienst in Winkel 2 mit "Zurück" api verwenden.

import {Component} from '@angular/core'; 
import {Location} from '@angular/common'; 


@Component({ directives: [ROUTER_DIRECTIVES] }) 
@RouteConfig([ 
    {...}, 
]) 
class AppCmp { 
    constructor(private _location: Location) { 
    } 
    backClicked() { 
     this._location.back(); 
    } 
} 
Verwandte Themen