File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1030,7 +1030,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
10301030 * See {@link ng.$compile#-bindtocontroller- `bindToController`}.
10311031 * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
10321032 * Disabled by default.
1033- * - `$...` – `{function()=}` – additional annotations to provide to the directive factory function.
1033+ * - `$...` – additional properties to attach to the directive factory function and the controller
1034+ * constructor function. (This is used by the component router to annotate)
10341035 *
10351036 * @returns {ng.$compileProvider } the compile provider itself, for chaining of function calls.
10361037 * @description
@@ -1106,6 +1107,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
11061107 forEach ( options , function ( val , key ) {
11071108 if ( key . charAt ( 0 ) === '$' ) {
11081109 factory [ key ] = val ;
1110+ controller [ key ] = val ;
11091111 }
11101112 } ) ;
11111113
Original file line number Diff line number Diff line change @@ -10044,6 +10044,22 @@ describe('$compile', function() {
1004410044 } ) ) ;
1004510045 } ) ;
1004610046
10047+ it ( 'should add additional annotations to the controller constructor' , function ( ) {
10048+ var myModule = angular . module ( 'my' , [ ] ) . component ( 'myComponent' , {
10049+ $canActivate : 'canActivate' ,
10050+ $routeConfig : 'routeConfig' ,
10051+ $customAnnotation : 'XXX'
10052+ } ) ;
10053+ module ( 'my' ) ;
10054+ inject ( function ( myComponentDirective ) {
10055+ expect ( myComponentDirective [ 0 ] . controller ) . toEqual ( jasmine . objectContaining ( {
10056+ $canActivate : 'canActivate' ,
10057+ $routeConfig : 'routeConfig' ,
10058+ $customAnnotation : 'XXX'
10059+ } ) ) ;
10060+ } ) ;
10061+ } ) ;
10062+
1004710063 it ( 'should return ddo with reasonable defaults' , function ( ) {
1004810064 angular . module ( 'my' , [ ] ) . component ( 'myComponent' , { } ) ;
1004910065 module ( 'my' ) ;
You can’t perform that action at this time.
0 commit comments