Skip to content

Instantly share code, notes, and snippets.

@sidthesloth92
Created April 2, 2016 19:18
Show Gist options
  • Save sidthesloth92/50e30c837f1f0523a719e90ef5778d60 to your computer and use it in GitHub Desktop.
Save sidthesloth92/50e30c837f1f0523a719e90ef5778d60 to your computer and use it in GitHub Desktop.
import {Component, OnInit} from 'angular2/core';
import {RouteParams, RouteData} from 'angular2/router';
@Component({
selector : 'view-two',
template: `These are the values returned from view one: <br />
Route Parameter : {{ routeParameter }} <br />
Query Parameter : {{ queryParameter }} <br />
Route Data : {{ routeData }} <br />
<button (click)="goBack()">Go Back</button>`
})
export class ViewTwoComponent implements OnInit{
public routeParameter : string = "empty";
public queryParameter : string = "empty";
public routeData : string = "empty";
constructor(private _routeParams : RouteParams, private _routeData : RouteData) {}
ngOnInit() {
this.routeParameter = this._routeParams.get('routeParameter');
this.queryParameter = this._routeParams.get('queryParameter');
this.routeData = this._routeData.get('routeData');
}
goBack() {
window.history.back();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment