question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting maxlength attribute dynamically since beta 11

See original GitHub issue

I just finished upgrading to ionic2 beta 11 (and angular rc4) changing my forms to @angular/forms. With the old forms, I was using ion-textarea with a dynamic value to maxlength, e.g: [attr.maxlength]="VariableThatHoldsMaxLength"

and the maxlength was copied PROPERLY to the native <textarea> inside.

Since upgrading to beta 11 - this stopped working and I can no longer set it dynamically - it is not being copied to the native element.

If I set a static value like maxlength="5" - it is being copied PROPERLY to the native element. Trying interpolation like maxlength="{{VariableThatHoldsMaxLength}}" does not work. Trying “native property” [maxlength]="VariableThatHoldsMaxLength" also does not work.

Thanks, Eddy

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
Barryrowecommented, Nov 29, 2016

It appears between beta.11 and rc.3, the support for the type=“number” attributes (step, min, max) was lost on ion-input.

3reactions
hadrien-tomacommented, Nov 25, 2016

I am facing the same issue with an <ion-input type="number">, I can’t bind to the min, max and step properties as I described in this forum’s topic.

My @angular/forms dependency is 2.1.1 and my ionic-angular dependency is 2.0.0-rc.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting maxlength attribute dynamically since beta 11 #7635
I'm having a similar issue setting the max attribute dynamically with ion-input type="date", also on beta 11, also with @angular/forms version ...
Read more >
Why can I not use dot notation while setting `maxlength ...
I am using Firefox and I wanted to add dynamically created input to the document. I use the dot notation to set attributes....
Read more >
ngMaxlength - AngularJS: API
ngMaxlength adds the maxlength validator to ngModel . It is most often used for text-based input controls, but can also be applied to...
Read more >
HTML attribute: maxlength - MDN Web Docs
The maxlength attribute defines the maximum number of characters (as UTF-16 code units) the user can enter into an <input> or <textarea> ....
Read more >
Dynamically Add/Remove Validators in Angular Reactive Forms
1. “setValidators()” method remove all the previous / default validators from Form Control. For e.g., Suppose during form initialization, you set maxLength and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found