TypeDefinition | UI-Router
Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TypeDefinition

Defines the behavior of a custom Type. See: UrlMatcherFactory.type

Hierarchy

  • TypeDefinition

Implemented by

Index

Methods

  • decode(val: string, key?: string): any
  • Converts a parameter value (from URL string or transition param) to a custom/native value.

  • Converts a parameter value (from URL string or transition param) to a custom/native value.

    Parameters

    • val: string
      :

      The URL parameter value to decode.

    • key Optional: string
      :

      The name of the parameter in which val is stored. Can be used for meta-programming of Type objects.

    Returns any

    :

    a custom representation of the URL parameter value.


  • encode(val: any, key?: string): string | Array<string>
  • Encodes a custom/native type value to a string that can be embedded in a URL. Note that the return value does not need to be URL-safe (i.e. passed through encodeURIComponent()), it only needs to be a representation of val that has been coerced to a string.

  • Encodes a custom/native type value to a string that can be embedded in a URL. Note that the return value does not need to be URL-safe (i.e. passed through encodeURIComponent()), it only needs to be a representation of val that has been coerced to a string.

    Parameters

    • val: any
      :

      The value to encode.

    • key Optional: string
      :

      The name of the parameter in which val is stored. Can be used for meta-programming of Type objects.

    Returns string | Array<string>

    :

    a string representation of val that can be encoded in a URL.


  • equals(a: any, b: any): boolean
  • Determines whether two decoded values are equivalent.

  • Determines whether two decoded values are equivalent.

    Parameters

    • a: any
      :

      A value to compare against.

    • b: any
      :

      A value to compare against.

    Returns boolean

    :

    true if the values are equivalent/equal, otherwise false.


  • is(val: any, key?: string): boolean
  • Detects whether a value is of a particular type. Accepts a native (decoded) value and determines whether it matches the current Type object.

  • Detects whether a value is of a particular type. Accepts a native (decoded) value and determines whether it matches the current Type object.

    Parameters

    • val: any
      :

      The value to check.

    • key Optional: string
      :

      If the type check is happening in the context of a specific UrlMatcher object, this is the name of the parameter in which val is stored. Can be used for meta-programming of Type objects.

    Returns boolean

    :

    true if the value matches the type, otherwise false.


Generated using TypeDoc