Say I have an object such as:
obj = {foo: 42, bar: 'moo'}
And an interpolate string such as:
s = 'Do {{ bar }} {{ foo }} times.'
Interpolating this in Angular:
var interp = $interpolate(s);
var res = interp(obj);
console.log(res); // <--- This will return 'Do moo 42 times.'
Is there a way I can express dotted/nested notation? Example:
obj = {n: {foo: 42}, bar: 'moo'}
s = 'Do {{ bar }} {{ n.foo }} times.' // <--- This doesn't work
var interp = $interpolate(s);
var res = interp(obj);
console.log(res);
jsfiddle. Try it jsfiddle.net/utnqdfwdxisn.foo, but how can I reference the object itself so interpolating{{ x }}will actually return the value ofobj.n.foo?