New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support overriding selectors of directives on import. #915
Comments
why not something more declarative @Component(...)
@Template({
directives: [
Directive.selectorAs('other-selector').templateUrlAs('other.html')
]
})
export class Cmp {
} define overwrites in the prototype @Component(...)
@Template({
directives: [
Overwrite(Directive)
.component({ selector: 'other-selector' })
.template({ url: 'other.html' })
]
})
export class Cmp {
} 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 @Component(...)
@Template({
directives: [
@Component({ selector: 'other-selector' })
@Template({ url: 'other.html' })
Overwrite(Directive)
]
})
export class Cmp {
} 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 import {Component, Template, directivePrefixer} from 'angular2/angular2';
import {button} from 'material-directives/suite';
// prefix helper in suite or angular itself
import * as ngMaterial, {prefix} from 'material-directives/suite';
@Component(...)
@Template({
directives: [
prefix('ng', ngMaterial) // or built in helper from ng2 as directivePrefixer
]
})
export class Cmp {
} |
@gdi2290 your examples don't work in practice. :-( It has to do with types of objects which need to be created to satisfy both Dart and JS. prefix idea does not work with selectors. For example |
oh that's right, I'm still thinking of selectors as element only. no worries I should probably learn a bit more about Dart to figure something that works for both. |
@mhevery can we revisit this? I would like for folders to export a namespace for example
import {OverWrite} from '@angular/common';
import {IndexComponent} from './Index.component'
export const HomeComponent = new NameSpace({
component: IndexComponent,
prefixSelector: 'home' // home-index
}); the idea is to keep files relative as much as possible so we can potentially remove the developer having to write out the namespace |
Will not implement. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
It should be possible to override the selector of a component on import.
PROBLEMS
The text was updated successfully, but these errors were encountered: