Ionic 3 - All imports are unused warning (even though they are being used)

后端 未结 3 725
鱼传尺愫
鱼传尺愫 2021-02-15 16:55

I am getting the following error when trying to run a prod build using the following

ionic cordova build browser --prod

Getting lot

3条回答
  •  离开以前
    2021-02-15 17:20

    Working form with my ionic 3 App:

    import {FormBuilder, FormGroup, Validators  } from '@angular/forms';
    
    
    @IonicPage()
    @Component({
      selector: 'page-mobile-login',
      templateUrl: 'mobile-login.html',
    })
    export class MobileLoginPage {
        public loginForm:FormGroup;
    
        constructor(public navCtrl: NavController, 
          public navParams: NavParams,
          public formBuilder: FormBuilder) 
          {
              this.loginForm = formBuilder.group({
                  mobile: ['', Validators.compose([Validators.required,Validators.pattern('[0-9 ]*'),
                    Validators.maxLength(10),Validators.minLength(10)])]
                });
          }
    
    
    }
    

    Seems issue you are using another function setForm() in constructor.

    mobile-login.html

    Enter Valid Mobile Number

提交回复
热议问题