Closed nulayuhz closed 5 years ago
Thanks for submitting the PR for this, but before merging it, can you please elaborate more on your issue? What version of Angular are you using? Are you importing it in the AppModule? Can you share a code sample?
Regarding the fix with the forRoot
, here's a quote from Angular's doc page:
Use forRoot() to separate providers from a module so you can import that module into the root module with providers and child modules without providers.
I'm not sure that's exactly what we need here but it's good to know whether you've tested your solution and if it solves the issue.
Hi, I am using Angular 5, the issue I am having is when I import it under AppModule, the value accessor is not working in components in the child modules. Sorry for creating a PR without testing, let I verify and do some testings.
I'm using it currently in Angular 7 and importing this module inside the SharedModule and exporting it back. This way it's accessible through the feature modules.
You are right about the SharedModule export, that was the thing I was missing, thank you.
Is there any other solution for this?
Using the SharedModule is a workaround. Basically the same as importing it directly in every child module, just with less scattered code. It is not applicable to a lot of use cases.
For example, I have 3 apps: 1 library project, and 2 apps that use the library. Inside the library there are some textareas that I want trimmed. In the 1st app I want to use the trimming, but not in the 2nd app. So, I can't push this module import all the way down to the library project. I want to import it only in the AppModule of the 1st app.
Hi,
When I import this module, components in my child modules are not getting the directive applied. So I import it to each of my module and then it works. I have not tested but I suspect if you add the forRoot method that can fix this issue.
Thanks