This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1024,6 +1024,8 @@ function $ParseProvider() {
1024
1024
switch ( typeof exp ) {
1025
1025
case 'string' :
1026
1026
1027
+ exp = trim ( exp ) ;
1028
+
1027
1029
if ( exp . charAt ( 0 ) === ':' && exp . charAt ( 1 ) === ':' ) {
1028
1030
oneTime = true ;
1029
1031
exp = exp . substring ( 2 ) ;
Original file line number Diff line number Diff line change @@ -2196,6 +2196,22 @@ describe('$compile', function() {
2196
2196
} )
2197
2197
) ;
2198
2198
2199
+ it ( 'should one-time bind if the expression starts with a space and two colons' , inject (
2200
+ function ( $rootScope , $compile ) {
2201
+ $rootScope . name = 'angular' ;
2202
+ element = $compile ( '<div name="attr: {{::name}}">text: {{ ::name }}</div>' ) ( $rootScope ) ;
2203
+ expect ( $rootScope . $$watchers . length ) . toBe ( 2 ) ;
2204
+ $rootScope . $digest ( ) ;
2205
+ expect ( element . text ( ) ) . toEqual ( 'text: angular' ) ;
2206
+ expect ( element . attr ( 'name' ) ) . toEqual ( 'attr: angular' ) ;
2207
+ expect ( $rootScope . $$watchers . length ) . toBe ( 0 ) ;
2208
+ $rootScope . name = 'not-angular' ;
2209
+ $rootScope . $digest ( ) ;
2210
+ expect ( element . text ( ) ) . toEqual ( 'text: angular' ) ;
2211
+ expect ( element . attr ( 'name' ) ) . toEqual ( 'attr: angular' ) ;
2212
+ } )
2213
+ ) ;
2214
+
2199
2215
2200
2216
it ( 'should process attribute interpolation in pre-linking phase at priority 100' , function ( ) {
2201
2217
module ( function ( ) {
You can’t perform that action at this time.
0 commit comments