Repository navigation
Description
Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
In an ion-textarea, setting a variable in (ngModelChange) in a function fired by(ngModelChange) only works once. That is the content of the textarea only gets updated once. 'characterRemaining' does get updated in the app.
I started with Ionic v2 two weeks ago. This is my first mobile app....
PS. With this current configuration 'maxlength' didn't seem to do anything, hence this effort.
Expected behavior:
The textarea should be updated every time the function changes the model variable.
Steps to reproduce:
Related code:
<ion-label>{{charactersRemaining}}</ion-label>
<form [formGroup]="viewForm" (ngSubmit)="submitView()">
<ion-textarea type="text" placeholder="Enter your view here." [(ngModel)]="view.text" formControlName="viewTextArea" rows="6" (ngModelChange)="viewTextChange()"></ion-textarea>
<button ion-button type="submit" block>Send</button>
</form>
I would expect that if the last line was uncommented the textarea would always display 'frank':
public viewTextChange() {
var left = this.viewMaxLength-this.view.text.length;
if (left < 0) {
this.view.text = '' + this.oldViewText;
left = this.viewMaxLength-this.view.text.length;
}
this.charactersRemaining = (this.viewMaxLength-this.view.text.length) + ' characters remaining.';
this.oldViewText = this.view.text;
/* this.view.text = 'frank'; */
}
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v4.6.1
Xcode version: Not installed
package.json:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "2.1.1",
"@angular/compiler": "2.1.1",
"@angular/compiler-cli": "2.1.1",
"@angular/core": "2.1.1",
"@angular/forms": "2.1.1",
"@angular/http": "2.1.1",
"@angular/platform-browser": "2.1.1",
"@angular/platform-browser-dynamic": "2.1.1",
"@angular/platform-server": "2.1.1",
"@ionic/storage": "1.1.6",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.45",
"typescript": "2.0.6"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "DMUViews: An Ionic project"
}
Activity
fix(keyboard): big keyboard/input refactor
fix(keyboard): big keyboard/input refactor
ionitron-bot commentedon Sep 2, 2018
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.