question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docs: update Ivy compatibility guide to include a note on styling precedence changes

See original GitHub issue

we 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:closed
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
pkozlowski-opensourcecommented, Apr 8, 2020

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

1reaction
atscottcommented, Oct 19, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found