This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1030,7 +1030,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1030
1030
* See {@link ng.$compile#-bindtocontroller- `bindToController`}.
1031
1031
* - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
1032
1032
* 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)
1034
1035
*
1035
1036
* @returns {ng.$compileProvider } the compile provider itself, for chaining of function calls.
1036
1037
* @description
@@ -1106,6 +1107,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1106
1107
forEach ( options , function ( val , key ) {
1107
1108
if ( key . charAt ( 0 ) === '$' ) {
1108
1109
factory [ key ] = val ;
1110
+ controller [ key ] = val ;
1109
1111
}
1110
1112
} ) ;
1111
1113
Original file line number Diff line number Diff line change @@ -10012,6 +10012,22 @@ describe('$compile', function() {
10012
10012
} ) ) ;
10013
10013
} ) ;
10014
10014
10015
+ it ( 'should add additional annotations to the controller constructor' , function ( ) {
10016
+ var myModule = angular . module ( 'my' , [ ] ) . component ( 'myComponent' , {
10017
+ $canActivate : 'canActivate' ,
10018
+ $routeConfig : 'routeConfig' ,
10019
+ $customAnnotation : 'XXX'
10020
+ } ) ;
10021
+ module ( 'my' ) ;
10022
+ inject ( function ( myComponentDirective ) {
10023
+ expect ( myComponentDirective [ 0 ] . controller ) . toEqual ( jasmine . objectContaining ( {
10024
+ $canActivate : 'canActivate' ,
10025
+ $routeConfig : 'routeConfig' ,
10026
+ $customAnnotation : 'XXX'
10027
+ } ) ) ;
10028
+ } ) ;
10029
+ } ) ;
10030
+
10015
10031
it ( 'should return ddo with reasonable defaults' , function ( ) {
10016
10032
angular . module ( 'my' , [ ] ) . component ( 'myComponent' , { } ) ;
10017
10033
module ( 'my' ) ;
You can’t perform that action at this time.
0 commit comments