Is there any way I can use Angular's $interpolate with an array instead of an object?
Example code:
var exp = $interpolate('Hello {{name}}!');
var res = exp({name: "foo"});
var exp2 = $interpolate('Hello {{0}}!');
var res2 = exp2(["foo"]);
console.log(res); // Hello foo
console.log(res2); // Hello 0 <--- Should be "Hello foo"
var exp2 = $interpolate('Hello {{this[0]}}!');
var res2 = exp2(["foo"]);
console.log(res2);
Note: only works with angular 1.3.x and up
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With