Help Angular by taking a 1 minute survey!Go to surveyHome

WrappedValue

Indicates that the result of a Pipe transformation has changed even though the reference has not changed.

See more...

      
      class WrappedValue {
  static wrap(value: any): WrappedValue
  static unwrap(value: any): any
  static isWrapped(value: any): value is WrappedValue
  constructor(value: any)
  wrapped: any
}
    

Description

Wrapped values are unwrapped automatically during the change detection, and the unwrapped value is stored.

Example:

if (this._latestValue === this._latestReturnedValue) { return this._latestReturnedValue; } else { this._latestReturnedValue = this._latestValue; return WrappedValue.wrap(this._latestValue); // this will force update }
      
      if (this._latestValue === this._latestReturnedValue) {
   return this._latestReturnedValue;
 } else {
   this._latestReturnedValue = this._latestValue;
   return WrappedValue.wrap(this._latestValue); // this will force update
 }
    

Static methods

Creates a wrapped value.

static wrap(value: any): WrappedValue
      
      static wrap(value: any): WrappedValue
    
Parameters
value any
Returns

WrappedValue

Returns the underlying value of a wrapped value. Returns the given value when it is not wrapped.

static unwrap(value: any): any
      
      static unwrap(value: any): any
    
Parameters
value any
Returns

any

Returns true if value is a wrapped value.

static isWrapped(value: any): value is WrappedValue
      
      static isWrapped(value: any): value is WrappedValue
    
Parameters
value any
Returns

value is WrappedValue

Constructor

constructor(value: any)
      
      constructor(value: any)
    
Parameters
value any

Properties

Property Description
wrapped: any