ngMock.$componentController

  1. service in module ngMock

A service that can be used to create instances of component controllers.

Be aware that the controller will be instantiated and attached to the scope as specified in the component definition object. That means that you must always provide a $scope object in the locals param.

Usage

$componentController(componentName, locals, [bindings], [ident]);

Arguments

Param Type Details
componentName string

the name of the component whose controller we want to instantiate

locals Object

Injection locals for Controller.

bindings
(optional)
Object

Properties to add to the controller before invoking the constructor. This is used to simulate the bindToController feature and simplify certain kinds of tests.

ident
(optional)
string

Override the property name to use when attaching the controller to the scope.

Returns

Object

Instance of requested controller.

doc_AngularJS
2016-03-29 16:11:56
Comments
Leave a Comment

Please login to continue.