@@ -2182,29 +2182,27 @@ angular.mock.$ControllerDecorator = ['$delegate', function($delegate) {
2182
2182
* @return {Object } Instance of requested controller.
2183
2183
*/
2184
2184
angular . mock . $ComponentControllerProvider = [ '$compileProvider' , function ( $compileProvider ) {
2185
- return {
2186
- $get : [ '$controller' , '$injector' , function ( $controller , $injector ) {
2187
- return function $componentController ( componentName , locals , bindings , ident ) {
2188
- // get all directives associated to the component name
2189
- var directives = $injector . get ( componentName + 'Directive' ) ;
2190
- // look for those directives that are components
2191
- var candidateDirectives = directives . filter ( function ( directiveInfo ) {
2192
- // components have controller, controllerAs and restrict:'E'
2193
- return directiveInfo . controller && directiveInfo . controllerAs && directiveInfo . restrict === 'E' ;
2194
- } ) ;
2195
- // check if valid directives found
2196
- if ( candidateDirectives . length === 0 ) {
2197
- throw new Error ( 'No component found' ) ;
2198
- }
2199
- if ( candidateDirectives . length > 1 ) {
2200
- throw new Error ( 'Too many components found' ) ;
2201
- }
2202
- // get the info of the component
2203
- var directiveInfo = candidateDirectives [ 0 ] ;
2204
- return $controller ( directiveInfo . controller , locals , bindings , ident || directiveInfo . controllerAs ) ;
2205
- } ;
2206
- } ]
2207
- } ;
2185
+ this . $get = [ '$controller' , '$injector' , function ( $controller , $injector ) {
2186
+ return function $componentController ( componentName , locals , bindings , ident ) {
2187
+ // get all directives associated to the component name
2188
+ var directives = $injector . get ( componentName + 'Directive' ) ;
2189
+ // look for those directives that are components
2190
+ var candidateDirectives = directives . filter ( function ( directiveInfo ) {
2191
+ // components have controller, controllerAs and restrict:'E'
2192
+ return directiveInfo . controller && directiveInfo . controllerAs && directiveInfo . restrict === 'E' ;
2193
+ } ) ;
2194
+ // check if valid directives found
2195
+ if ( candidateDirectives . length === 0 ) {
2196
+ throw new Error ( 'No component found' ) ;
2197
+ }
2198
+ if ( candidateDirectives . length > 1 ) {
2199
+ throw new Error ( 'Too many components found' ) ;
2200
+ }
2201
+ // get the info of the component
2202
+ var directiveInfo = candidateDirectives [ 0 ] ;
2203
+ return $controller ( directiveInfo . controller , locals , bindings , ident || directiveInfo . controllerAs ) ;
2204
+ } ;
2205
+ } ] ;
2208
2206
} ] ;
2209
2207
2210
2208
0 commit comments