Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Angular 2 form validator for ionic 2

$
0
0

@zhouhaowowtv wrote:

Please refer to https://medium.com/@daviddentoom/angular-2-form-validation-9b26f73fcb81#.34i1pqpq5.

But I have a problem to implement angular 2 form validator in my ionic 2 project. Here is what I did:

  • Create an ionic application

ionic start formValidator blank --v2

  • In app/pages/home/home.js:

    import {Page} from 'ionic/ionic';
    import { FormBuilder,Validators,Control,ControlGroup,FORM_DIRECTIVES
    } from 'angular2/common';
    import {UsernameValidator} from '../../usernameValidator';
    
    @Page({
        templateUrl: 'build/pages/home/home.html',
        directives: [FORM_DIRECTIVES]
    })
  • In app/pages/home/home.html:

     <form [ngFormModel]="form">

I got the following error message:

EXCEPTION: TypeError: Cannot read property 'validator' of undefined in [form in HomePage@7:8]

Do I miss anything? Thanks

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>