* @ngdoc service * @name $controller * @description * A decorator for ng.$controller with additional `bindings` parameter, useful when testing * controllers of directives that use $compile#-bindtocontroller- `bindToController`. * * ## Example * * ```js * * // Directive defi
()
| 2544 | * @return {Object} Instance of given controller. |
| 2545 | */ |
| 2546 | function createControllerDecorator() { |
| 2547 | angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { |
| 2548 | return function(expression, locals, later, ident) { |
| 2549 | if (later && typeof later === 'object') { |
| 2550 | var instantiate = $delegate(expression, locals, true, ident); |
| 2551 | var instance = instantiate(); |
| 2552 | angular.extend(instance, later); |
| 2553 | return instance; |
| 2554 | } |
| 2555 | return $delegate(expression, locals, later, ident); |
| 2556 | }; |
| 2557 | }]; |
| 2558 | |
| 2559 | return angular.mock.$ControllerDecorator; |
| 2560 | } |
| 2561 | |
| 2562 | /** |
| 2563 | * @ngdoc service |
no test coverage detected