You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Directives cannot be used in more than one module. For example, in main NgModule:
,
import {MyDirective} from './myDirective';
I need to use MyDirective in another module, as it provides general purpose functionality.
If I declare the directive in the other module, I get an error:
Error: Type MyDirective is part of the declarations of 2 modules: Module1 and Module2!
On the other hand, if I just try to use the directive without declaring it in the second module, the directive is undefined.
Expected/desired behavior
There is no way to define a Directive at the top level Module and have lower level modules use that same directive. If you declare it in both modules there is an error. If you don't declare it in the second module it is undefined.
Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).
What is the expected behavior?
Allow directive to be shared between modules.
What is the motivation / use case for changing the behavior?
I have a general purpose directive, need to be able to use it in more than one module.
Please tell us about your environment:
windows
Angular version: 2.0.0-rc.X
RC5
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
I'm submitting a ... (check one with "x")
Current behavior
Directives cannot be used in more than one module. For example, in main NgModule:
,
import {MyDirective} from './myDirective';
@NgModule({
imports: [
...
],
declarations: [
MyDirective
],
I need to use MyDirective in another module, as it provides general purpose functionality.
If I declare the directive in the other module, I get an error:
Error: Type MyDirective is part of the declarations of 2 modules: Module1 and Module2!
On the other hand, if I just try to use the directive without declaring it in the second module, the directive is undefined.
Expected/desired behavior
There is no way to define a Directive at the top level Module and have lower level modules use that same directive. If you declare it in both modules there is an error. If you don't declare it in the second module it is undefined.
Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).
What is the expected behavior?
Allow directive to be shared between modules.
What is the motivation / use case for changing the behavior?
I have a general purpose directive, need to be able to use it in more than one module.
Please tell us about your environment:
windows
RC5
Chrome
Typescript
The text was updated successfully, but these errors were encountered: