Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you escape a space in Angular?

I have an object like this:

foo = {"Foo Bar":"bar","Foo":"Bar"};

In my Jade template I have:

p 1: {{foo.Foo Bar}}
p 2: {{foo.Foo}}

Problem is, the output is:

1: {{foo.Foo Bar}} 
2: Bar

But it should be:

1: bar
2: Bar

Why is this problem happening? How do I fix this?

like image 876
CommaToast Avatar asked Dec 13 '25 18:12

CommaToast


1 Answers

You can access it like this

p 1: {{foo["Foo Bar"]}}
like image 116
zs2020 Avatar answered Dec 15 '25 09:12

zs2020



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!