Skip to main content

$jsapi.resolvePath

This method converts relative state paths to absolute ones.

Syntax

The method accepts two arguments:

  • The absolute path to the state relative to which the result should be resolved.
  • The relative path to be resolved.

How to use

$jsapi.resolvePath($context.currentState, ".."); // => Path to the parent of the current state

$jsapi.resolvePath('/state1', "./state2/state3"); // => "/state1/state2/state3"

$jsapi.resolvePath('/state1', "/root"); // => "/root"

$jsapi.resolvePath('/state1', "state2"); // => "/state1/state2"

$jsapi.resolvePath('/state1', "./state2/.."); // => "/state1"