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 8
8
9
9
function classDirective ( name , selector ) {
10
10
name = 'ngClass' + name ;
11
+
12
+ // Mark toClassString as $stateful since it essentially adds state by
13
+ // collapsing nested collections
14
+ toClassString . $stateful = true ;
15
+
11
16
var indexWatchExpression ;
12
17
13
18
return [ '$parse' , function ( $parse ) {
Original file line number Diff line number Diff line change @@ -567,6 +567,19 @@ describe('ngClass', function() {
567
567
} )
568
568
) ;
569
569
570
+ it ( 'should track changes of mutating object inside an array literal' ,
571
+ inject ( function ( $rootScope , $compile ) {
572
+ $rootScope . classVar = { orange : true } ;
573
+ element = $compile ( '<div ng-class="[classVar]"></div>' ) ( $rootScope ) ;
574
+
575
+ $rootScope . $digest ( ) ;
576
+ expect ( element ) . toHaveClass ( 'orange' ) ;
577
+
578
+ $rootScope . $apply ( 'classVar.orange = false' ) ;
579
+ expect ( element ) . not . toHaveClass ( 'orange' ) ;
580
+ } )
581
+ ) ;
582
+
570
583
describe ( 'large objects' , function ( ) {
571
584
var getProp ;
572
585
var veryLargeObj ;
You can’t perform that action at this time.
0 commit comments