$interpolate an array instead of an object

Viewed 86

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"
1 Answers
Related