How to use the @uirouter/core.ResolveContext function in @uirouter/core

To help you get started, we’ve selected a few @uirouter/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ui-router / react / src / components / UIView.tsx View on Github external
viewConfigUpdated(newConfig: ReactViewConfig) {
    if (newConfig === this.uiViewData.config) {
      return;
    }

    let trans: Transition;
    let resolves = {};

    if (newConfig) {
      let viewContext: ViewContext = newConfig.viewDecl && newConfig.viewDecl.$context;
      this.uiViewAddress = {
        fqn: this.uiViewAddress.fqn,
        context: viewContext,
      };

      let resolveContext = new ResolveContext(newConfig.path);
      let injector = resolveContext.injector();

      let stringTokens: string[] = resolveContext.getTokens().filter(x => typeof x === 'string');
      if (stringTokens.indexOf('transition') !== -1) {
        throw TransitionPropCollisionError;
      }

      trans = injector.get(Transition);
      resolves = stringTokens.map(token => [token, injector.get(token)]).reduce(applyPairs, {});
    }

    this.uiViewData.config = newConfig;
    const key = Date.now();
    let props = { ...resolves, transition: trans, key };

    let newComponent = newConfig && newConfig.viewDecl && newConfig.viewDecl.component;