Walking through a tutorial app for use with the Ionic platform, which is built on angular 1.2.4, I've hit a confusing error in this Angular markup:
<content has-header="true" scroll="false">
<list>
<item ng-repeat="project in projects" ng-click="selectProject(project)" ng-class="{active:activeProject==project}">
{{project.title}}
</item>
</list>
</content>
The error in chrome console is:
Error: [$parse:syntax] Syntax Error: Token 'itemClass' is an unexpected token
at column 33 of the expression [{active:activeProject==project} itemClass]
starting at [itemClass].
If you change the ng-class attribute thusly (add a semicolon) :
<item ng-repeat="project in projects"
ng-click="selectProject(project)"
ng-class="{active:activeProject==project};">
then the error goes away.
The ionic forum users are wondering why this is. I've found lots of SO posts on ng-class, and reviewed the docs, but nowhere can I find evidence that the trailing semicolon is a requirement, e.g. this post.
My best guess is that Angular is jamming (minifying) the class code together with something else and a semicolon is not being inserted automatically before javascript tries to run it; but the Angular docs say it doesn't use eval(), so it's puzzling how it fails.
Would love to know why this is happening.