docs: update Ivy compatibility guide to include a note on styling precedence changes
See original GitHub issuewe have a css class used to show/hide element. and we also have angular directive to take input and add/remove this class using host binding. below is the code.
@Directive({ selector: '[ngShow]', host: { '[class.hidden]': '!ngShow', '[attr.aria-hidden]': '!ngShow' } }) export class NgShowDirective { @Input() ngShow = false; }
Usage:
<div class="hidden" [ngShow]="asyncProperty">test 123</div>
when we set asyncProperty value to true after execution of an async function, it does not remove the “hidden” css class. this worked in angular v8 and started to break after v9 upgrade.
tested against v9.1.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Version 9 of Angular Now Available — Project Ivy has arrived!
When their binding values are updated, the new values will override any competing bindings. You can read more about styling precedence rules in ......
Read more >Ivy User Manual - or emacs
Customizability is about being able to use different methods and interfaces of completion to tailor the selection process. For example, adding a custom...
Read more >Apache Ivy™ Documentation 2.5.0-rc1
In this tutorial, you will see one of the simplest ways to use Ivy. With no specific settings, Ivy uses the Maven 2...
Read more >Ivy compatibility examples - Angular Hispano
In Ivy, bindings are checked in the order they are defined in the template, regardless of whether they are directive input bindings or...
Read more >Spring Boot Reference Documentation
Although you could copy Spring Boot jars, we generally recommend that you use a build tool that supports dependency management (such as Maven...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I believe that it works as designed in Angular v9: classes added on an element have a higher priority that ones coming from a host binding. Yes, this is change from the v8 behaviour, but this is a deliberate change. You can find more info here: https://angular.io/guide/template-syntax#styling-precedence
As discussed here, this is working as intended in Ivy and the styling precedence is described here: https://angular.io/guide/style-precedence. Keeping this open, since it should be included in the compatibility guide