Comments (17)
if it was to not work, why did you guys build it????????????!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!wtf
Please be respectful, this is open source work you don't have to use.
from ngx-mask.
@dgouissem We used ValueAccessor in our current realization, but angular have limitation -> we can use only one realization ValueAccessor. That why ngx-mask don't work with material.
from ngx-mask.
if it was to not work, why did you guys build it????????????!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!wtf
from ngx-mask.
still not fix here?
from ngx-mask.
Still the recommended option is not to use this library ?
from ngx-mask.
[UPDATE]
I don't know where previous link was redirecting but correct link is here
ng-bootstrap/ng-bootstrap#2291 (comment)
Basically use Racoon mask instead of ngx-mask
from ngx-mask.
@dgouissem We used ValueAccessor in our current realization, but angular have limitation -> we can use only one realization ValueAccessor. That why ngx-mask don't work with material.
Could you please add this as a big disclaimer in the documentation?
from ngx-mask.
Has anyone found a simpler solution?
There is no simple solution
from ngx-mask.
There is a workaround solution not using ngx-mask library
Take a look in this issue: angular/angular#16755
from ngx-mask.
@dgouissem Thanks, we will check
from ngx-mask.
I have the same problem when try to use mask in combination with bsDatepicker.
<div class="form-group">
<label class="control-label col-lg-2 text-right">Birthday</label>
<div class="col-lg-4">
<input type="text" class="form-control" formControlName="birthday" placeholder="MM/DD/YYYY" mask="00/00/0000" autocomplete="off" bsDatepicker>
</div>
</div>
from ngx-mask.
I manage to create a workaround that works perfectly based on my expectation. I created a hidden input that handles the datepicker, the mask itself is attached to the actual input that is visible and added a event listener dateSelect
to set the value from the date picker to the actual input with mask.
EDIT: I also added the positionTarget input to make the datepicker look that its been initialized in the actual input
<div class="input-group">
<input type="text" class="form-control" #startDateInput id="startDate" formControlName="startDate" [leadZeroDateTime]="true" mask="d0/M0/0000" />
<input type="hidden" (dateSelect)="onDateSelect($event, 'startDate')" ngbDatepicker #start="ngbDatepicker" [positionTarget]="startDateInput">
<button class="btn" (click)="start.toggle()" type="button">
<i class="mdi mdi-calendar"></i>
</button>
</div>
onDateSelect(date: NgbDate, key: string): void {
const formControl: any = {};
formControl[key] = this.dateAdapter.toModel(date);
this.form.patchValue(formControl);
}
from ngx-mask.
there's another way here too: ng-bootstrap/ng-bootstrap#2291 (comment).
use RacoonMask and NativeDateAdapter.
from ngx-mask.
I manage to create a workaround that works perfectly based on my expectation. I created a hidden input that handles the datepicker, the mask itself is attached to the actual input that is visible and added a event listener
dateSelect
to set the value from the date picker to the actual input with mask.EDIT: I also added the positionTarget input to make the datepicker look that its been initialized in the actual input
<div class="input-group"> <input type="text" class="form-control" #startDateInput id="startDate" formControlName="startDate" [leadZeroDateTime]="true" mask="d0/M0/0000" /> <input type="hidden" (dateSelect)="onDateSelect($event, 'startDate')" ngbDatepicker #start="ngbDatepicker" [positionTarget]="startDateInput"> <button class="btn" (click)="start.toggle()" type="button"> <i class="mdi mdi-calendar"></i> </button> </div>
onDateSelect(date: NgbDate, key: string): void { const formControl: any = {}; formControl[key] = this.dateAdapter.toModel(date); this.form.patchValue(formControl); }
Please, can you help me.
I'm getting error Cannot find name 'DateAdapter'
When I implement this code
from ngx-mask.
May I ask if what is the status of this issue? I wish to implement a proper solution, not a workaround although it is working fine.
I am using ngbDatepicker of ng-bootstrap (Angular 11) and having this error in console
Error: More than one custom value accessor matches form control with unspecified name attribute.
Thank you.
from ngx-mask.
Same issue here :/
from ngx-mask.
Has anyone found a simpler solution?
from ngx-mask.
Related Issues (20)
- Not able to add a zero value when using separator mask HOT 1
- Option for replacing the zero instead of a number after the separator
- Have max length checking for input HOT 2
- Dynamically placeholder value
- Issue with updating ngModel value of Angular input and mask
- Cursor jumps on multi mask
- dynamically [mask] removes Special Characters even if [dropSpecialCharacters] ="false"
- placeHolderCharacter doesn't work with keepCharacterPositions
- Selecting one or multiple values and then replacing it results in strange behaviour HOT 1
- It is impossible to enter more than 4 digits in input, when thousandSeparator="," is used on input HOT 4
- Clearing input field in Firefox with backspace key using a mask not clearing input correctly
- I want to use both period ('.') and comma (',') as input
- Deleting 5 after entering say 500 causes everything to be deleted HOT 1
- Mask with or (||) does not work.
- Input marked dirty after updating to Angular 17 HOT 2
- Trailing Decimal Not Added When mask="separator.1" and leadZero="true"
- The onChange is triggered when [mask] change even if the triggerOnMaskChange is false. Input becomes dirty when maskChanged.
- Issue with simple alphanumerical mask with blank spaces
- Form control valueChanges is called on init HOT 2
- Multiple masks with copy and paste input
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 ngx-mask.