AngularJS Directives: Expression or Interpolation?

AngularJS seems to be inconsistent on whether a directive can contain an expression or requires an expression to be wrapped in interpolation brackets {{ thusly }}.

Here is a partial list of directives consisting of ones that have bitten me.

Directive Expression or Interpolation? Notes
ng-class Expression Accepts an object, array or string.
ng-src Interpolation
ng-href Interpolation
ng-srcset Interpolation
ng-style Expression Give it an object.
ng-include Interpolation Accepts a string.
This entry was posted in Programming and tagged , , , . Bookmark the permalink.

Leave a Reply