Open ghost opened 8 years ago
Sorry if i don't understand your question. But this might be what you are looking for.
import { Inject, Component } from 'ng-forward'
import { IStateService } from 'angular-ui-router'
type ILocationService = angular.ILocationService
/**
* @author john
* @version 4/8/116
*/
@Component({
selector: 'some-comp',
template: ``
})
@Inject('$state', '$location')
export class SomeComponent {
constructor (private $state: IStateService, private $location: ILocationService) {
this.$state.go('some-state')
// or
this.$location.url('/homePage')
}
}
When a button is pressed, I need to authenticate the user before setting the URL allowing the user to route to the next page. Thus I can't use ui-sref. I tried $location.Path and $state.go and neither is defined.
import { $state } from 'ng-forward'; is undefined... thus subsequent @Inject or $state.go("/homePage"); will fail.
What alternative would you suggest ... hopefully not javascript force a new URL.
Thanks, Chuck Duncan Camp Systems, Merrimack, NH