UiOnParamsChanged | @uirouter/angular
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • UiOnParamsChanged

Index

Methods

uiOnParamsChanged

  • uiOnParamsChanged(newParams: {}, trans?: Transition): void
  • A UI-Router view has an Angular Component (see Ng2ViewDeclaration.component). The Component may define component-level hooks which UI-Router will call at the appropriate times. These callbacks are similar to Transition Hooks ([[IHookRegistry]]), but are only called if the view/component is currently active.

    The uiOnParamsChanged callback is called when parameter values change.

    This callback is used to respond dynamic parameter values changing. It is called when a transition changed one or more dynamic parameter values, and the routed component was not destroyed.

    It receives two parameters:

    • An object with (only) changed parameter values. The keys are the parameter names and the values are the new parameter values.
    • The [[Transition]] which changed the parameter values.

    Example:

    @Component({
      template: '<input type="text">'
    })
    class MyComponent {
      uiOnParamsChanged(newParams: { [paramName: string]: any }, trans: Transition) {
        Object.keys(newParams).forEach(paramName => {
          console.log(`${paramName} changed to ${newParams[paramName]}`)
        });
      }
    }

    Parameters

    • newParams: {}
      • [paramName: string]: any
    • Optional trans: Transition

    Returns void

Generated using TypeDoc