Support overriding selectors of directives on import.
See original GitHub issueIt should be possible to override the selector of a component on import.
@Decorator({
selector: 'some-selector'
})
class Directive {}
@Component(...)
@Template({
directives: [
new DirectiveBinding({key: Directive, selector: 'other-selector')
]
})
PROBLEMS
- this would make it hard to know all selectors statically, as it requires execution of code to know what the selector is.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Is there an easy way to overwrite base directive?
Reimplement/extend the directive by yourself and import it in a module instead of the original one · Use the "adjusted" fork of angular...
Read more >Overriding dependencies in the Angular injector hierarchy
Overriding dependencies in Angular. Overriding dependencies in Angular requires two key properties: provide — this points to the dependency ...
Read more >Use Angular directives to extend components that you don't own
Angular directives allow us to extend components without changing their internal code. This is useful to bring a consistent UX to 3rd party ......
Read more >Overriding CSS properties of third-party components in Angular
You can override a third-party component's CSS properties either at an enclosing component or global level. Unless you want to affect all the ......
Read more >Directive - Angular
selector1, selector2 : Select if either selector1 or selector2 matches. Angular only allows directives to apply on CSS selectors that do not cross...
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
Will not implement.
why not something more declarative
Directive.selectorAs('other-selector')
or something likedefine overwrites in the prototype or
create a container but then the container needs to know the types of annotations so what if you can just annotate the container which will overwrite the Directive
I’m not even sure if that’s possible or even if that is something people want since it’s even more code but its pretty simple to reason about why that works perhaps.
Should there be a way to define a suite of directives? or at least best practice