Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IRootScopeService

Hierarchy

  • IRootScopeService

Index

Properties

$$isolateBindings

$$isolateBindings: any

$$phase

$$phase: any

$id

$id: number

$parent

$parent: IScope

$root

Methods

$apply

  • $apply(): any
  • $apply(exp: string): any
  • $apply(exp: (scope: IScope) => any): any
  • Returns any

  • Parameters

    • exp: string

    Returns any

  • Parameters

    Returns any

$applyAsync

  • $applyAsync(): any
  • $applyAsync(exp: string): any
  • $applyAsync(exp: (scope: IScope) => any): any
  • Returns any

  • Parameters

    • exp: string

    Returns any

  • Parameters

    Returns any

$broadcast

  • Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners.

    The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled.

    Any exception emitted from the listeners will be passed onto the $exceptionHandler service.

    Parameters

    • name: string

      Event name to broadcast.

    • Rest ...args: any[]

      Optional one or more arguments which will be passed onto the event listeners.

    Returns IAngularEvent

$destroy

  • $destroy(): void
  • Returns void

$digest

  • $digest(): void
  • Returns void

$emit

  • Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners.

    The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it.

    Any exception emitted from the listeners will be passed onto the $exceptionHandler service.

    Parameters

    • name: string

      Event name to emit.

    • Rest ...args: any[]

      Optional one or more arguments which will be passed onto the event listeners.

    Returns IAngularEvent

$eval

  • $eval(): any
  • $eval(expression: string, locals?: Object): any
  • $eval(expression: (scope: IScope) => any, locals?: Object): any
  • Returns any

  • Parameters

    • expression: string
    • Optional locals: Object

    Returns any

  • Parameters

    • expression: (scope: IScope) => any
    • Optional locals: Object

    Returns any

$evalAsync

  • $evalAsync(): void
  • $evalAsync(expression: string, locals?: Object): void
  • $evalAsync(expression: (scope: IScope) => void, locals?: Object): void
  • Returns void

  • Parameters

    • expression: string
    • Optional locals: Object

    Returns void

  • Parameters

    • expression: (scope: IScope) => void
        • Parameters

          Returns void

    • Optional locals: Object

    Returns void

$isSuspended

  • $isSuspended(): boolean
  • Call this method to determine if this scope has been explicitly suspended. It will not tell you whether an ancestor has been suspended. To determine if this scope will be excluded from a digest triggered at the $rootScope, for example, you must check all its ancestors:

    function isExcludedFromDigest(scope) {
      while(scope) {
        if (scope.$isSuspended()) return true;
        scope = scope.$parent;
      }
      return false;
    

    Be aware that a scope may not be included in digests if it has a suspended ancestor, even if $isSuspended() returns false.

    Returns boolean

    true if the current scope has been suspended.

$new

  • Parameters

    • Optional isolate: boolean
    • Optional parent: IScope

    Returns IScope

$on

  • $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): () => void
  • Listens on events of a given type. See $emit for discussion of event life cycle.

    The event listener function format is: function(event, args...).

    Parameters

    • name: string

      Event name to listen on.

    • listener: (event: IAngularEvent, ...args: any[]) => any

      Function to call when the event is emitted.

    Returns () => void

      • (): void
      • Listens on events of a given type. See $emit for discussion of event life cycle.

        The event listener function format is: function(event, args...).

        Returns void

$resume

  • $resume(): void
  • Resume watchers of this scope subtree in case it was suspended.

    See {$rootScope.Scope#$suspend} for information about the dangers of using this approach.

    Returns void

$suspend

  • $suspend(): void
  • Suspend watchers of this scope subtree so that they will not be invoked during digest.

    This can be used to optimize your application when you know that running those watchers is redundant.

    Warning

    Suspending scopes from the digest cycle can have unwanted and difficult to debug results. Only use this approach if you are confident that you know what you are doing and have ample tests to ensure that bindings get updated as you expect.

    Some of the things to consider are:

    • Any external event on a directive/component will not trigger a digest while the hosting scope is suspended - even if the event handler calls $apply() or $rootScope.$digest().
    • Transcluded content exists on a scope that inherits from outside a directive but exists as a child of the directive's containing scope. If the containing scope is suspended the transcluded scope will also be suspended, even if the scope from which the transcluded scope inherits is not suspended.
    • Multiple directives trying to manage the suspended status of a scope can confuse each other:
      • A call to $suspend() on an already suspended scope is a no-op.
      • A call to $resume() on a non-suspended scope is a no-op.
      • If two directives suspend a scope, then one of them resumes the scope, the scope will no longer be suspended. This could result in the other directive believing a scope to be suspended when it is not.
    • If a parent scope is suspended then all its descendants will be also excluded from future digests whether or not they have been suspended themselves. Note that this also applies to isolate child scopes.
    • Calling $digest() directly on a descendant of a suspended scope will still run the watchers for that scope and its descendants. When digesting we only check whether the current scope is locally suspended, rather than checking whether it has a suspended ancestor.
    • Calling $resume() on a scope that has a suspended ancestor will not cause the scope to be included in future digests until all its ancestors have been resumed.
    • Resolved promises, e.g. from explicit $q deferreds and $http calls, trigger $apply() against the $rootScope and so will still trigger a global digest even if the promise was initiated by a component that lives on a suspended scope.

    Returns void

$watch

  • $watch(watchExpression: string, listener?: string, objectEquality?: boolean): () => void
  • $watch<T>(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void
  • $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): () => void
  • $watch<T>(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void
  • Parameters

    • watchExpression: string
    • Optional listener: string
    • Optional objectEquality: boolean

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    • T

    Parameters

    • watchExpression: string
    • Optional listener: (newValue: T, oldValue: T, scope: IScope) => any
        • (newValue: T, oldValue: T, scope: IScope): any
        • Parameters

          • newValue: T
          • oldValue: T
          • scope: IScope

          Returns any

    • Optional objectEquality: boolean

    Returns () => void

      • (): void
      • Returns void

  • Parameters

    • watchExpression: (scope: IScope) => any
    • Optional listener: string
    • Optional objectEquality: boolean

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    • T

    Parameters

    • watchExpression: (scope: IScope) => T
    • Optional listener: (newValue: T, oldValue: T, scope: IScope) => any
        • (newValue: T, oldValue: T, scope: IScope): any
        • Parameters

          • newValue: T
          • oldValue: T
          • scope: IScope

          Returns any

    • Optional objectEquality: boolean

    Returns () => void

      • (): void
      • Returns void

$watchCollection

  • $watchCollection<T>(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void
  • $watchCollection<T>(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void
  • Type parameters

    • T

    Parameters

    • watchExpression: string
    • listener: (newValue: T, oldValue: T, scope: IScope) => any
        • (newValue: T, oldValue: T, scope: IScope): any
        • Parameters

          • newValue: T
          • oldValue: T
          • scope: IScope

          Returns any

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    • T

    Parameters

    • watchExpression: (scope: IScope) => T
    • listener: (newValue: T, oldValue: T, scope: IScope) => any
        • (newValue: T, oldValue: T, scope: IScope): any
        • Parameters

          • newValue: T
          • oldValue: T
          • scope: IScope

          Returns any

    Returns () => void

      • (): void
      • Returns void

$watchGroup

  • $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void
  • $watchGroup(watchExpressions: ((scope: IScope) => any)[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void
  • Parameters

    • watchExpressions: any[]
    • listener: (newValue: any, oldValue: any, scope: IScope) => any
        • (newValue: any, oldValue: any, scope: IScope): any
        • Parameters

          • newValue: any
          • oldValue: any
          • scope: IScope

          Returns any

    Returns () => void

      • (): void
      • Returns void

  • Parameters

    • watchExpressions: ((scope: IScope) => any)[]
    • listener: (newValue: any, oldValue: any, scope: IScope) => any
        • (newValue: any, oldValue: any, scope: IScope): any
        • Parameters

          • newValue: any
          • oldValue: any
          • scope: IScope

          Returns any

    Returns () => void

      • (): void
      • Returns void

Generated using TypeDoc