The ng.$controller $controller service is used by AngularJS to create new controllers.

This provider allows controller registration via the ng.$controllerProvider#register register method.

Constructors

Properties

Methods

Constructors

Properties

$get: (string | (($injector: any) => ((expression: any, locals: any, later: any, ident: any) => any)))[] = ...

$get method for dependency injection.

A service function that creates controllers.

Methods

  • Adds an identifier to the controller instance in the given locals' scope.

    Parameters

    • locals: any

      The locals object containing the scope.

    • identifier: string

      The identifier to assign.

    • instance: any

      The controller instance.

    • name: string

      The name of the controller.

    Returns void

  • Check if a controller with a given name exists.

    Parameters

    • name: string

      Controller name to check.

    Returns boolean

    True if the controller exists, false otherwise.

  • Register a controller.

    Parameters

    • name: any

      Controller name, or an object map of controllers where the keys are the names and the values are the constructors.

    • constructor: Function | any[]

      Controller constructor function (optionally decorated with DI annotations in the array notation).

    Returns void