I think here is a problem - you are comparing to `current`, which is the current value of the class on the element. We need to however compare to the previous value set by this particular component, which means that previous value has to be passed as second argument to `$set()`.

Say, interpolation (`class="{{cls}}"`) calls set "a b c".
Then, `ng-class="xxx"` calls set to "d".
This will remove "a b c" and add "d", which is not correct.

I suggested a solution in https://github.com/angular/angular.js/issues/4960#issuecomment-28549402