Comments (7)
Having the same error message after updating my tsconfig.json
(angular 6.10) from:
"compilerOptions": {
"target": "es5",
to:
"compilerOptions": {
"target": "es6",
With this change, I can reliably turn the bug on and off.
I guess that there is a side-effect of the transpilation that uncovers the bug.
For now, I have reverted to es5 - I was just checking out generator support.
My guess is that adding a constructor that calls the super constructor will fix the issue.
from ng-trim-value-accessor.
Upgrading from 1.0.1 to 2.0.2 throws next error:
TypeError: Class constructor DefaultValueAccessor cannot be invoked without 'new'
from ng-trim-value-accessor.
What exact version of Angular are you using? Can you provide a plunker?
from ng-trim-value-accessor.
I'm thinking this DefaultValueAccessor was never meant to be extended. These host bindings only work on the subclass, i.e. they don't inherit, this is why you have bug #11. Because your (blur) handler overrides (in actuality it could never run as "only the subclasses host bindings will run") the parent classes (blur) host binding that points to OnTouched(). As I look at this, and try to hack a solution, the only thing that comes to mind is to just copy DefaultValueAccessor and hack that, i.e. don't inherit anything. It has implementation that it figures is important, but that's in private methods inaccessible from a subclass, so you can't just subclass it, steal its host bindings and override a couple methods (writeValue, _handleInput) to get what you want. I'm gonna try to write this from scratch using the DefaultValueAccessor as a template to start from. Probably the only way.
from ng-trim-value-accessor.
ok, seems like this is working. I have to wrap it in tests, but I figure this is the way to go (copy and hack DefaultValueAccessor). I also added :not(input:[matAutoComplete], the only material accessor I know that it had been clashing with: you can only have one accessor per form control. In reality, no trim needed for autocomplete, so no big deal there.
my accessor
from ng-trim-value-accessor.
hello there, this looks like a common issue among all libraries that extend DefaultValueAccessor. I opened a question here, so we can merge our forces to deal with this problem:
please feel free to contribute
from ng-trim-value-accessor.
Thanks for your detailed report. Please feel free to open a PR for the fix and I will be happy to merge it.
from ng-trim-value-accessor.
Related Issues (20)
- touched broken for matInput HOT 3
- inputs(except those whose type is password) are always untouched HOT 2
- Email inputs are not updated
- doesn't work when an input has [readonly]="condition" data-binding HOT 5
- bound value not set
- I get "More than one custom value accessor matches form control with unspecified name attribute" HOT 1
- why at the end of the apostrophe?
- core.js:1598 ERROR Error: Uncaught (in promise): Error: More than one custom value accessor matches form control with unspecified name attribute HOT 1
- Unable to use [(ngModel)] in mat-autocomplete when ng-trim-value-accessor is used HOT 1
- Does not work with Ivy HOT 2
- not support in Angular 8 HOT 4
- Doesn't work with closure compiler HOT 2
- Add forRoot Method to TrimValueAccessorModule HOT 5
- Trim should not be applied to input type number HOT 1
- Apply trimmed value on blur HOT 5
- ng build --prod fails with `...src/trim-value-accessor.ts has no selector, please add it!` HOT 1
- Error: More than one custom value accessor
- Provide an op-out option
- Does not run with Angular 5 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-trim-value-accessor.