I want to create a details page in Angular and want to pass an entry id with the RouterLink. Is there a way to get the parameter in the url?
The URL looks like: http://localhost:8080/details?date=13-09-2016
Also RouteParams can be used to get the parameter. You can injected it to your component:
@Component(...)
class MyDetailsComponent {
final RouteParams _routeParams;
MyDetailsComponent(this._routeParams){
var date = _routeParams.get('date');
}
}
You can find more details here.
Implement OnActivate
@override
routerOnActivate(ComponentInstruction nextInstruction,
ComponentInstruction prevInstruction) {
String routeParamValue = nextInstruction.params['paramName'];
String queryParamValue = nextInstruction.urlParams['paramName'];
}
params to queryParams for query parameters. param is for route parameters (path: '/some/:paramName/other')@RouteConfig(const [ const Route(path: '/view', name: 'Home', component: SimpleKVComponent, useAsDefault: true), const Route(path: '/settings', name: 'Settings', component: SettingsComponent), const Route(path: '/details', name: 'Details', component: DetailsComponent) ])<td><a [routerLink]="['/Details', { date: history['link'] }]"><i class="glyphicon glyphicon-eye-open"></i></a></td>class DetailsComponent implements OnActivate {?