Search code examples
angularangular-hybrid

Navigating to another component in hybrid Angular


I cannot figure out how can I navigate to another page/component with hybrid Angular.

In Angular 2 we use Router and something like:

this.router.navigate(['/items']);

In hybrid Angular I use hybrid routing with:

import { UIRouterUpgradeModule, NgHybridStateDeclaration } from '@uirouter/angular-hybrid';

How can I navigate from within typescript to another page/component with hybrid Angular?


Solution

  • You are actually using the uirouter. It is the hybrid version but still it is the uirouter. For the equivalent of this.router.navigate you can use:

    this.uirouter.stateService.go('items');