Directive not working when the form is inited by the first time
This is a...
- [ ] feature request
- [x] bug report
- [ ] usage question
What toolchain are you using for transpilation/bundling?
- [x] @angular/cli
- [ ] Custom @ngTools/webpack
- [ ] Raw
ngc - [ ] SystemJS
- [ ] Rollup
- [ ] Other
Environment
NodeJS Version: 6.9.2 Typescript Version: 2.4.2 Angular Version: 4.4.6 @angular-redux/store version: 6.6.0 @angular/cli version: (if applicable) 1.6.3 OS: Win 10
Link to repo showing the issus
(optional, but helps a lot)
Expected Behaviour:
That directive work as expected at first time that the form is built and state on store reflect the form.
Actual Behaviour:
The state doesn't update when a form change occurss, also, no action is fired
Stack Trace/Error Message:
No stack trace
Additional Notes:
Again, the directive only works when I open my form by the secont time
Not sure how to help with this. Can you supply more details? A repo I can look at? How have you hooked everything up?
Also, what do you mean by "open my form the second time"? Do you create and destroy it using ngIf? Are you navigating to a page and then away and then back again?
Of course I can, sorry for the poor info. 😖 I can't share the repo here, but the reactive form is inside a modal trigred by route (if is important, isn't the primary router-outlet). The steps are these:
- user log in the application
- user navigate to the specific route (e.g. /app/(dashboard/form))
- at this point, after the form show up to the user (we have a ngif within too), the store isn't update with the default form state, and when a valueChanges is fired, no action is triggered too
- navigate out from the route, like /app/(dashboard) 'closing' the modal with the form
- open again the modal with the form
- the store state was updated as expected, and all changes triggers the action
The reactive form is build on ngOnInit of the modal component, the variable used in the ngIf is set to true asynchronously...
Sounds decently complicated enough that I probably won't get the reproduction quite correct. Is it possible for you to create a toy repo showing the issue?