Closed sscovil closed 7 years ago
Thank you @sscovil! I will keep this in mind during next development cycle.
Thanks @sscovil for bringing it up!
@slavafomin When I first started going thru the code to see if I should use this project in my own code, the ngModel
overwriting did freak me out a bit. But then I went thru the entire thing and felt more comfortable.
I'm not an angular expert, so I wasn't aware of decorators being even an option.
Actually, we are not overwriting ngModel
but rather attaching to it using it's name. I think it's a valid use case. Also, I'm trying to interfere with Angular internals as little as possible sticking to the ngModel interface. This approach proved to work pretty fine over ~three years.
@sscovil could you please provide details on how you see this approach dangerous and not recommended.
Sidenote: I later realized that declaring another directive as ngModel
does not overwrite it, but only attaches another directive to that name. All is well. If the OP is okay, we could close out this issue.
I was just looking through the source and noticed that you are overwriting the
ngModel
directive with your own custom version. This can be very dangerous for people using different versions of Angular, and is not recommended.Instead, consider refactoring your code to add a decorator to
ngModel
.