r/angularjs • • Dec 11 '13

Angular would be great for super-responsive layouts except it doesn't work in IE

Edit: Solved! Thanks Evereal!

Check it out

Here it is being used on site I'm working on (ignore the sluggish masonry, I'm working on it).

Look! Responsive images:

http://i.embed.ly/1/display/crop?height={{(1000 * window_width/ 2 * retina) | decimal}}&width={{(1000 * window_width* retina) | decimal}}&url={{topstory.image}}&key=jlakjflakjflakjfal;kja;lkja;lkjalkj

('retina' = 2 if it's a retina display, 1 if it's not)

Pretty neat, huh? You can get a perfect layout on any screen right down to the last pixel. EXCEPT IT DOESN'T WORK IN IE.

Here's the issue

I guess I'm hoping someone has a solution to the IE bug, because to me this is so much cooler than css media queries. I'm considering telling IE users to just fuck off.

2 Upvotes

20 comments sorted by

View all comments

Show parent comments

5

u/evereal Dec 11 '13 edited Dec 11 '13

Yes, I tried it with the plunkr, yes ngStyle works. No, you don't need to use a function.

See: http://plnkr.co/edit/Boy09W1QNkvJXGTU6P2j?p=preview

And no, I still wouldn't recommend this.

-3

u/InterwebCountyPress Dec 11 '13

Woohoo! Thank you! I'm going to post that plunkr over in the github issue queue if you don't mind.

And I'm using it, sensible advice disregarded! haha

3

u/evereal Dec 11 '13 edited Dec 11 '13

The very first comment in the github issue is "Use ngStyle". My example is exactly what they mean. Some people complain that it's a work-around, but it is actually the correct, cleaner way to do this kind of thing.

-1

u/InterwebCountyPress Dec 11 '13

I guess the syntax was stumping me and the others in there.

6

u/mnsota Dec 11 '13

Please edit your post with SOLVED and the solution so the rest of us don't have to fall down this ladder of comments. Thanks!