Hey everyone I was wondering how to get the state params from a state using Angular 2, TypeScript & ui-router. I tried reviewing the new docs but they don't seem to have much documentation for ng2 ui-router.
Below I have added my component.ts for reference. Any help would be greatly appreciated.
import {Component} from '@angular/core';
import {HTTP_PROVIDERS} from '@angular/http';
import {UIRouter} from 'ui-router-ng2/router';
@Component({
selector: 'Detail',
template: require('./detail.html'),
providers: [HTTP_PROVIDERS]
})
export class Detail {
constructor(private uiRouter:UIRouter) {
console.log('uiRouter ', this.uiRouter.globals.params);
}
}
In Angular 1 I would do this as follows:
(function() {
'use strict';
angular
.module('private')
.controller('Controller', Controller);
function Controller($state) {
var vm = this;
console.log($state.params.studentID);
}
})();
Again any advice would be greatly appreciated.