What is the difference between the following two code snippets,
Code 1:
<div class={{getClass()}}/>
Code 2:
<div ng-class=getClass()/>
With the first example before angular loads your class will literally be "{{getClass()}}". While in the second example the div won't have a class until angular runs its first digest.
There might be some minor differences with when they are recalculated but Angular will keep both up to date. I've run into issues before using the first method with Animation as ng-class has some hooks into animation.
ng-class. Outcome of OP example will result in same but ng-class has more specific use than class alsoclass="form-group" ng-class="{ 'has-error': form.course.subtitle.$invalid && isSubmitted}" they are not anywhere near the same
ng-classwill be evaluated at the end of everydigest, where as{{ getClass() }}is evaluated once.ng-classis usually used to evaluate expressions and apply class(es) based on expressions