I'm using some data from Google Analytics in my app, which uses colons in the hash keys. For example,
var pages = [{
'ga:sessions': 100,
'ga:adImpressions': 1000
}, ...];
But Angular runs into problems when I want to order by something with a colon. This:
<div ng-repeat="page in pages | orderBy:'ga:sessions':true">
Throws this:
Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected
token at column 3 of the expression [ga:sessions] starting at
[:sessions].
EDIT: Here's what I've already tried:
- Storing the key in a var and using orderBy:myKey:true
- Escaping the colon with \
- And in an act of desperation, using the unicode escape code for colon