Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-touched never applied #804

Closed
tjvantoll opened this issue May 16, 2017 · 2 comments · Fixed by #836
Closed

ng-touched never applied #804

tjvantoll opened this issue May 16, 2017 · 2 comments · Fixed by #836
Assignees
Labels
Milestone

Comments

@tjvantoll
Copy link

tjvantoll commented May 16, 2017

This was reported in a comment on https://www.nativescript.org/blog/requiring-form-fields-with-nativescript-and-angular#comment-3308236632 and I confirmed the behavior in a sample app.

Problem: The ng-touched class name is never applied in NativeScript + Angular apps. As an example try out the following code.

<ActionBar title="Form Tester" class="action-bar"></ActionBar>
<StackLayout class="p-20">
    <Label text="Required Textfield" class="h1 text-center"></Label>
    <TextField required hint="fill this out..." [(ngModel)]="textField" #element></TextField>
    <TextField></TextField>
    <Label [text]="element.className"></Label>
</StackLayout>
import { Component } from "@angular/core";

@Component({
    selector: "ns-items",
    moduleId: module.id,
    templateUrl: "./items.component.html",
})
export class ItemsComponent {
    textField;
}

In this example the label shows all class names associated with the “#element” text field.

Expected behavior: When you blur the first text field, the ng-untouched class name changes to ng-touched. Angular on the web works this way.
Actual behavior: When you blur the first text field the ng-untouched class name remains.

@danielgek
Copy link

@tjvantoll i think this is related with the last comments of #526

@sis0k0 sis0k0 added the bug label May 17, 2017
@sis0k0 sis0k0 added this to the 3.1 TBD milestone May 17, 2017
@vakrilov vakrilov removed this from the 3.1 milestone Jun 8, 2017
@sis0k0 sis0k0 added this to the 3.1 milestone Jun 8, 2017
@sis0k0 sis0k0 removed the help wanted label Jun 8, 2017
@sis0k0 sis0k0 self-assigned this Jun 8, 2017
sis0k0 added a commit that referenced this issue Jun 8, 2017
@vchimev vchimev self-assigned this Jun 12, 2017
@vchimev vchimev reopened this Jun 13, 2017
@vchimev
Copy link
Contributor

vchimev commented Jun 13, 2017

nativescript-angular@3.1.0-2017-06-14-1686 and NativeScript/tests-app-ng#24

Errors:

  • common - navigating back and forward:
ERROR Error: Uncaught (in promise): Error: Current componentRef is different for cached componentRef
JS: Error: Current componentRef is different for cached componentRef
  • checked-value-accessor - works
  • date-value-accessor - error with ngModel directive::
ERROR TypeError: Cannot read property 'getDay' of undefined
  • number-value-accessor - works
  • selectedIndex-value-accessor - does NOT work, NO error
  • text-value-accessor - works
  • time-value-accessor - does NOT work:

Error fixed by #843:

ERROR TypeError: jit_nodeValue4(...).onTouch is not a function
JS: ERROR CONTEXT [object Object]

Error with ngModel directive:

JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'getHours' of null
JS: TypeError: Cannot read property 'getHours' of null

@sis0k0 sis0k0 modified the milestones: 3.2 TBD, 3.1 Jul 5, 2017
@vakrilov vakrilov modified the milestones: 4.x (TBD), 4.3 Aug 21, 2017
sis0k0 added a commit that referenced this issue Sep 8, 2017
accessors

`touch` event is not suitable for triggering ngOnTouch classes for iOS
and is causing several issues, such as overriding the change event.

related #804
related #866
fixes #887
sis0k0 added a commit that referenced this issue Sep 13, 2017
…accessors (#986)

`touch` event is not suitable for triggering ngOnTouch classes for iOS
and is causing several issues, such as overriding the change event.

related #804
related #866
fixes #887
@tsonevn tsonevn added the forms label Oct 17, 2017
@vchimev vchimev removed their assignment May 29, 2018
@vakrilov vakrilov modified the milestones: 5.x (TBD), 6.1 (TBD) May 30, 2018
@tsonevn tsonevn modified the milestones: 6.1 (TBD), next Jul 18, 2018
@manoldonev manoldonev modified the milestones: 6.2 (TBD), 6.1 Aug 10, 2018
@ghost ghost removed the bug label Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants