angular: Parsing html template with [hidden] fails in IE9/10
I just started to test app which is built on top of Angular2 in different environments and it turned out there are some issues on IE (mostly 9) and I’ll try to let you know about them.
One of them is html parser. When trying to parse following lines:
<div [hidden]="!isAuthorized">
I get such error on both IE9 and IE10:
Template parse errors: Can't bind to 'hidden' since it isn't a known native property
Code above works on modern browsers like a charm.
To fix it I had to make a workaround which seem to have no problems:
<div [style.display]="isAuthorized ? 'block' : 'none'">
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 3
- Comments: 22 (14 by maintainers)
better alternative to slow
*ngIf
is combination of[attr.data-hidden]
(instead of[hidden]
) and rule[data-hidden="true"]{display: none !important}
in global CSS.Yes, IE 9 and IE 10. Small group of ugly browsers.
On Mon, 25 Apr 2016 at 18:10 Olivier Combe notifications@github.com wrote:
@e-oz solution, can’t handle conditional var initialization, like:
[attr.data-hidden]="someVar"
but works if you explicitly check var init:
[attr.data-hidden]="someVar?true:false"
btw, i hate you IE a lot of patches to make you run…