Created
April 2, 2016 19:18
-
-
Save sidthesloth92/50e30c837f1f0523a719e90ef5778d60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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