* @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
()
| 2295 | * @return {Object} Instance of given controller. |
| 2296 | */ |
| 2297 | function createControllerDecorator() { |
| 2298 | angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { |
| 2299 | return function(expression, locals, later, ident) { |
| 2300 | if (later && typeof later === 'object') { |
| 2301 | var instantiate = $delegate(expression, locals, true, ident); |
| 2302 | var instance = instantiate(); |
| 2303 | angular.extend(instance, later); |
| 2304 | return instance; |
| 2305 | } |
| 2306 | return $delegate(expression, locals, later, ident); |
| 2307 | }; |
| 2308 | }]; |
| 2309 | |
| 2310 | return angular.mock.$ControllerDecorator; |
| 2311 | } |
| 2312 | |
| 2313 | /** |
| 2314 | * @ngdoc service |
no test coverage detected