Can't bind to formGroup since it isn't a known property of 'form'. (" — Ionic Modal Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Can't bind to 'stackConfig' since it isn't a known property of 'div'. ("Angular parse error - Can't bind to … since it isn't a known property ofionic - Can't bind to 'src' since it isn't a known property of 'pdf-viewer'Template parse errors: Can't bind to 'formGroup' since it isn't a known property of 'form'Can't bind to 'FormGroup' since it isn't a known property of 'form' ----Angular reactive forms in an ionic modal componentcan't bind 'root' since it isn't a known property of 'ion-buttons'Can't bind to 'routerDirection' since it isn't a known property of 'div'Ionic4 / mobile Safari - Buttons on modal are not firing click event if angular-cropper component is presentFormGroup isn't a known property of form

How can a team of shapeshifters communicate?

Nose gear failure in single prop aircraft: belly landing or nose-gear up landing?

License to disallow distribution in closed source software, but allow exceptions made by owner?

Random body shuffle every night—can we still function?

Is it dangerous to install hacking tools on my private linux machine?

Can an iPhone 7 be made to function as a NFC Tag?

How much damage would a cupful of neutron star matter do to the Earth?

Does silver oxide react with hydrogen sulfide?

Test print coming out spongy

Is there public access to the Meteor Crater in Arizona?

Positioning dot before text in math mode

How to ask rejected full-time candidates to apply to teach individual courses?

How many time has Arya actually used Needle?

The Nth Gryphon Number

Why is it faster to reheat something than it is to cook it?

two integers one line calculator

Why weren't discrete x86 CPUs ever used in game hardware?

Is openssl rand command cryptographically secure?

If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?

Weaponising the Grasp-at-a-Distance spell

What does 丫 mean? 丫是什么意思?

New Order #6: Easter Egg

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

Simple Http Server



Can't bind to formGroup since it isn't a known property of 'form'. (" — Ionic Modal



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Can't bind to 'stackConfig' since it isn't a known property of 'div'. ("Angular parse error - Can't bind to … since it isn't a known property ofionic - Can't bind to 'src' since it isn't a known property of 'pdf-viewer'Template parse errors: Can't bind to 'formGroup' since it isn't a known property of 'form'Can't bind to 'FormGroup' since it isn't a known property of 'form' ----Angular reactive forms in an ionic modal componentcan't bind 'root' since it isn't a known property of 'ion-buttons'Can't bind to 'routerDirection' since it isn't a known property of 'div'Ionic4 / mobile Safari - Buttons on modal are not firing click event if angular-cropper component is presentFormGroup isn't a known property of form



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to use a reactive form in an Ionic Modal. I receive the - Can't bind to formGroup since it isn't a known property of 'form'. (" message. I have seen that this error is typically received when ReactiveFormsModule is not imported. In my case it is imported in the the app.module.ts file and pairing-modal.module.ts file. I am curious if maybe the imports are different when the form is in the modal component. I have also tried to only in the parent file( caller to the modal) with no success.



 app.module.ts:
import PairingModalPage from './pairing-modal/pairing-modal.page';
import WorkerService from './services/worker-service';
import Firebase from '@ionic-native/firebase/ngx';
import AngularFireFunctions from '@angular/fire/functions';
import AngularFireMessaging from '@angular/fire/messaging';
import FcmService from './fcm.service';
import PairingService from './services/pairing-service';
import CourseMemberService from './services/course-member.service';
import NgModule from '@angular/core';
import HttpClientModule from '@angular/common/http';
import BrowserModule from '@angular/platform-browser';
import RouteReuseStrategy from '@angular/router';
import IonicModule, IonicRouteStrategy from '@ionic/angular';
import SplashScreen from '@ionic-native/splash-screen/ngx';
import StatusBar from '@ionic-native/status-bar/ngx';
import BrowserAnimationsModule from '@angular/platform-
browser/animations';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AngularFireModule from '@angular/fire';
import AngularFireDatabaseModule from '@angular/fire/database';
import AngularFireAuthModule from '@angular/fire/auth';
import AngularFirestoreModule from '@angular/fire/firestore';
import environment from './../environments/environment';
import AuthService from './services/auth.service';
import CourseService from './services/course.services';
import EventService from './services/event.service';
import EventPlayingCountService from './services/event-playing-
count.service';
import GroupService from './services/group.service';
import GlobalService from './services/global.service';
import GroupEventService from './services/group-event';
import GroupInviteService from './services/group-invite.service';
import RsvpService from './services/rsvp.service';
import MemberService from './services/member.service';
import MatButtonModule,
MatCheckboxModule,
MatDividerModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatSelectModule,
MatListModule,
MatExpansionModule,
MatDialogModule,
MatCardModule,
MatProgressSpinnerModule
from '@angular/material';
import RsvpDialogComponent from './rsvp-dialog/rsvp-
dialog.component';
import GenDialogComponent from './gen-dialog/gen-dialog.component';
import SpinnerComponent from './spinner/spinner.component';
import ScorecardService from './services/scorecard.service';

@NgModule(
declarations: [ AppComponent, RsvpDialogComponent, GenDialogComponent,
SpinnerComponent, PairingModalPage ],
entryComponents: [
RsvpDialogComponent,
GenDialogComponent,
PairingModalPage,
],
imports: [BrowserModule,
IonicModule.forRoot(),
BrowserAnimationsModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireDatabaseModule,
AngularFireAuthModule,
AngularFirestoreModule,
MatButtonModule,
MatDividerModule,
MatCheckboxModule,
MatFormFieldModule,
MatSelectModule,
MatDatepickerModule,
MatListModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatExpansionModule,
MatListModule,
MatCardModule,
MatDialogModule,
MatInputModule,
MatProgressSpinnerModule,
HttpClientModule,
AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
RsvpService,
AuthService,
CourseService,
ScorecardService,
EventService,
EventPlayingCountService,
GroupService,
GroupInviteService,
MemberService,
PairingService,
GlobalService,
GroupEventService,
CourseMemberService,
FcmService,
WorkerService,
AngularFireMessaging,
AngularFireFunctions,
Firebase,
provide: RouteReuseStrategy, useClass: IonicRouteStrategy
],
bootstrap: [AppComponent]
)
export class AppModule

pairing-modal.module.ts (modal file)
import NgModule from '@angular/core';
import CommonModule from '@angular/common';
import FormsModule, ReactiveFormsModule from '@angular/forms';
import Routes, RouterModule from '@angular/router';

import IonicModule from '@ionic/angular';

import PairingModalPage from './pairing-modal.page';

const routes: Routes = [

path: '',
component: PairingModalPage

];

@NgModule(
imports: [
CommonModule,
FormsModule,
IonicModule,
ReactiveFormsModule,
RouterModule.forChild(routes)
],
declarations: [PairingModalPage],

)
export class PairingModalPageModule

pairing-modal.page.ts

import FormBuilder, FormControl from '@angular/forms';
import take from 'rxjs/operators';
import Subscription from 'rxjs/Subscription';
import Component from '@angular/core';
import ModalController, NavParams from '@ionic/angular';
import GroupService from '../services/group.service';
import RsvpService from '../services/rsvp.service';
import MemberService from '../services/member.service';

@Component(
selector: 'app-pairing-modal',
templateUrl: './pairing-modal.page.html',
styleUrls: ['./pairing-modal.page.scss'],
)
export class PairingModalPage

subscription: Subscription;
rsvpId: string;
members: any[] = [];
selected: any;

selectForm = this.fb.group(
members: new FormControl(),
);

constructor(
private modalCtrl: ModalController,
private groupService: GroupService,
private memberService: MemberService,
private rsvpService: RsvpService,
private fb: FormBuilder,
private navParams: NavParams,
)

ionViewWillEnter()
this.subscription = new Subscription;
this.rsvpId = this.navParams.get('rsvpId');
const subscription = this.rsvpService.getByDocId(this.rsvpId)
.valueChanges()
.pipe(take(1))
.subscribe((rsvp: any) =>
for (let group of rsvp.event.groups)
const groupSubscription = this.groupService.getByDocId(group)
.valueChanges()
.pipe(take(1))
.subscribe((group: any) =>
for (let member of group.members)
const memberSubscription =
this.memberService.getMemberByDocId(member)
.valueChanges()
.pipe(take(1))
.subscribe((member: any) =>
const tempMember = as any;
tempMember.id = member.id;
tempMember.firstname = member.firstname;
tempMember.lastname = member.lastname;
this.members.push(tempMember);
)
this.subscription.add(memberSubscription);

this.subscription.add(groupSubscription);
)
this.subscription.add(subscription);

)


savePairing()
console.log('this.selected', this.selected);
console.log('this.form', this.selectForm);
this.modalCtrl.dismiss(
members: this.selectForm.value,
);



modal-pairing.page.html

<ion-header>
<ion-toolbar>
<ion-title>pairingModal</ion-title>
</ion-toolbar>
</ion-header>

<ion-content padding>
<form [formGroup]="selectForm" (ngSubmit)="savePairing()">
<ion-item>
<ion-label>Members that are playing</ion-label>
<ion-select multiple="true" cancelText="Cancel" okText="Okay!">
<ion-select-option *ngFor="let member of members"
formControlName="members">

member.firstname member.lastname
</ion-select-option>
</ion-select>
</ion-item>
<ion-button size="small" type="submit" >
<label> Save </label>
</ion-button>
</form>
</ion-content>









share|improve this question






















  • I was able to correct this error by importing FormsModule and ReactiveFormsModule in the app.module.ts file. I don't quite understand why it is needed in the app.module.ts file when the form is on an Ionic Modal Page, but this worked for me.

    – scott sherman
    Mar 8 at 23:27

















0















I am trying to use a reactive form in an Ionic Modal. I receive the - Can't bind to formGroup since it isn't a known property of 'form'. (" message. I have seen that this error is typically received when ReactiveFormsModule is not imported. In my case it is imported in the the app.module.ts file and pairing-modal.module.ts file. I am curious if maybe the imports are different when the form is in the modal component. I have also tried to only in the parent file( caller to the modal) with no success.



 app.module.ts:
import PairingModalPage from './pairing-modal/pairing-modal.page';
import WorkerService from './services/worker-service';
import Firebase from '@ionic-native/firebase/ngx';
import AngularFireFunctions from '@angular/fire/functions';
import AngularFireMessaging from '@angular/fire/messaging';
import FcmService from './fcm.service';
import PairingService from './services/pairing-service';
import CourseMemberService from './services/course-member.service';
import NgModule from '@angular/core';
import HttpClientModule from '@angular/common/http';
import BrowserModule from '@angular/platform-browser';
import RouteReuseStrategy from '@angular/router';
import IonicModule, IonicRouteStrategy from '@ionic/angular';
import SplashScreen from '@ionic-native/splash-screen/ngx';
import StatusBar from '@ionic-native/status-bar/ngx';
import BrowserAnimationsModule from '@angular/platform-
browser/animations';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AngularFireModule from '@angular/fire';
import AngularFireDatabaseModule from '@angular/fire/database';
import AngularFireAuthModule from '@angular/fire/auth';
import AngularFirestoreModule from '@angular/fire/firestore';
import environment from './../environments/environment';
import AuthService from './services/auth.service';
import CourseService from './services/course.services';
import EventService from './services/event.service';
import EventPlayingCountService from './services/event-playing-
count.service';
import GroupService from './services/group.service';
import GlobalService from './services/global.service';
import GroupEventService from './services/group-event';
import GroupInviteService from './services/group-invite.service';
import RsvpService from './services/rsvp.service';
import MemberService from './services/member.service';
import MatButtonModule,
MatCheckboxModule,
MatDividerModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatSelectModule,
MatListModule,
MatExpansionModule,
MatDialogModule,
MatCardModule,
MatProgressSpinnerModule
from '@angular/material';
import RsvpDialogComponent from './rsvp-dialog/rsvp-
dialog.component';
import GenDialogComponent from './gen-dialog/gen-dialog.component';
import SpinnerComponent from './spinner/spinner.component';
import ScorecardService from './services/scorecard.service';

@NgModule(
declarations: [ AppComponent, RsvpDialogComponent, GenDialogComponent,
SpinnerComponent, PairingModalPage ],
entryComponents: [
RsvpDialogComponent,
GenDialogComponent,
PairingModalPage,
],
imports: [BrowserModule,
IonicModule.forRoot(),
BrowserAnimationsModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireDatabaseModule,
AngularFireAuthModule,
AngularFirestoreModule,
MatButtonModule,
MatDividerModule,
MatCheckboxModule,
MatFormFieldModule,
MatSelectModule,
MatDatepickerModule,
MatListModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatExpansionModule,
MatListModule,
MatCardModule,
MatDialogModule,
MatInputModule,
MatProgressSpinnerModule,
HttpClientModule,
AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
RsvpService,
AuthService,
CourseService,
ScorecardService,
EventService,
EventPlayingCountService,
GroupService,
GroupInviteService,
MemberService,
PairingService,
GlobalService,
GroupEventService,
CourseMemberService,
FcmService,
WorkerService,
AngularFireMessaging,
AngularFireFunctions,
Firebase,
provide: RouteReuseStrategy, useClass: IonicRouteStrategy
],
bootstrap: [AppComponent]
)
export class AppModule

pairing-modal.module.ts (modal file)
import NgModule from '@angular/core';
import CommonModule from '@angular/common';
import FormsModule, ReactiveFormsModule from '@angular/forms';
import Routes, RouterModule from '@angular/router';

import IonicModule from '@ionic/angular';

import PairingModalPage from './pairing-modal.page';

const routes: Routes = [

path: '',
component: PairingModalPage

];

@NgModule(
imports: [
CommonModule,
FormsModule,
IonicModule,
ReactiveFormsModule,
RouterModule.forChild(routes)
],
declarations: [PairingModalPage],

)
export class PairingModalPageModule

pairing-modal.page.ts

import FormBuilder, FormControl from '@angular/forms';
import take from 'rxjs/operators';
import Subscription from 'rxjs/Subscription';
import Component from '@angular/core';
import ModalController, NavParams from '@ionic/angular';
import GroupService from '../services/group.service';
import RsvpService from '../services/rsvp.service';
import MemberService from '../services/member.service';

@Component(
selector: 'app-pairing-modal',
templateUrl: './pairing-modal.page.html',
styleUrls: ['./pairing-modal.page.scss'],
)
export class PairingModalPage

subscription: Subscription;
rsvpId: string;
members: any[] = [];
selected: any;

selectForm = this.fb.group(
members: new FormControl(),
);

constructor(
private modalCtrl: ModalController,
private groupService: GroupService,
private memberService: MemberService,
private rsvpService: RsvpService,
private fb: FormBuilder,
private navParams: NavParams,
)

ionViewWillEnter()
this.subscription = new Subscription;
this.rsvpId = this.navParams.get('rsvpId');
const subscription = this.rsvpService.getByDocId(this.rsvpId)
.valueChanges()
.pipe(take(1))
.subscribe((rsvp: any) =>
for (let group of rsvp.event.groups)
const groupSubscription = this.groupService.getByDocId(group)
.valueChanges()
.pipe(take(1))
.subscribe((group: any) =>
for (let member of group.members)
const memberSubscription =
this.memberService.getMemberByDocId(member)
.valueChanges()
.pipe(take(1))
.subscribe((member: any) =>
const tempMember = as any;
tempMember.id = member.id;
tempMember.firstname = member.firstname;
tempMember.lastname = member.lastname;
this.members.push(tempMember);
)
this.subscription.add(memberSubscription);

this.subscription.add(groupSubscription);
)
this.subscription.add(subscription);

)


savePairing()
console.log('this.selected', this.selected);
console.log('this.form', this.selectForm);
this.modalCtrl.dismiss(
members: this.selectForm.value,
);



modal-pairing.page.html

<ion-header>
<ion-toolbar>
<ion-title>pairingModal</ion-title>
</ion-toolbar>
</ion-header>

<ion-content padding>
<form [formGroup]="selectForm" (ngSubmit)="savePairing()">
<ion-item>
<ion-label>Members that are playing</ion-label>
<ion-select multiple="true" cancelText="Cancel" okText="Okay!">
<ion-select-option *ngFor="let member of members"
formControlName="members">

member.firstname member.lastname
</ion-select-option>
</ion-select>
</ion-item>
<ion-button size="small" type="submit" >
<label> Save </label>
</ion-button>
</form>
</ion-content>









share|improve this question






















  • I was able to correct this error by importing FormsModule and ReactiveFormsModule in the app.module.ts file. I don't quite understand why it is needed in the app.module.ts file when the form is on an Ionic Modal Page, but this worked for me.

    – scott sherman
    Mar 8 at 23:27













0












0








0








I am trying to use a reactive form in an Ionic Modal. I receive the - Can't bind to formGroup since it isn't a known property of 'form'. (" message. I have seen that this error is typically received when ReactiveFormsModule is not imported. In my case it is imported in the the app.module.ts file and pairing-modal.module.ts file. I am curious if maybe the imports are different when the form is in the modal component. I have also tried to only in the parent file( caller to the modal) with no success.



 app.module.ts:
import PairingModalPage from './pairing-modal/pairing-modal.page';
import WorkerService from './services/worker-service';
import Firebase from '@ionic-native/firebase/ngx';
import AngularFireFunctions from '@angular/fire/functions';
import AngularFireMessaging from '@angular/fire/messaging';
import FcmService from './fcm.service';
import PairingService from './services/pairing-service';
import CourseMemberService from './services/course-member.service';
import NgModule from '@angular/core';
import HttpClientModule from '@angular/common/http';
import BrowserModule from '@angular/platform-browser';
import RouteReuseStrategy from '@angular/router';
import IonicModule, IonicRouteStrategy from '@ionic/angular';
import SplashScreen from '@ionic-native/splash-screen/ngx';
import StatusBar from '@ionic-native/status-bar/ngx';
import BrowserAnimationsModule from '@angular/platform-
browser/animations';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AngularFireModule from '@angular/fire';
import AngularFireDatabaseModule from '@angular/fire/database';
import AngularFireAuthModule from '@angular/fire/auth';
import AngularFirestoreModule from '@angular/fire/firestore';
import environment from './../environments/environment';
import AuthService from './services/auth.service';
import CourseService from './services/course.services';
import EventService from './services/event.service';
import EventPlayingCountService from './services/event-playing-
count.service';
import GroupService from './services/group.service';
import GlobalService from './services/global.service';
import GroupEventService from './services/group-event';
import GroupInviteService from './services/group-invite.service';
import RsvpService from './services/rsvp.service';
import MemberService from './services/member.service';
import MatButtonModule,
MatCheckboxModule,
MatDividerModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatSelectModule,
MatListModule,
MatExpansionModule,
MatDialogModule,
MatCardModule,
MatProgressSpinnerModule
from '@angular/material';
import RsvpDialogComponent from './rsvp-dialog/rsvp-
dialog.component';
import GenDialogComponent from './gen-dialog/gen-dialog.component';
import SpinnerComponent from './spinner/spinner.component';
import ScorecardService from './services/scorecard.service';

@NgModule(
declarations: [ AppComponent, RsvpDialogComponent, GenDialogComponent,
SpinnerComponent, PairingModalPage ],
entryComponents: [
RsvpDialogComponent,
GenDialogComponent,
PairingModalPage,
],
imports: [BrowserModule,
IonicModule.forRoot(),
BrowserAnimationsModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireDatabaseModule,
AngularFireAuthModule,
AngularFirestoreModule,
MatButtonModule,
MatDividerModule,
MatCheckboxModule,
MatFormFieldModule,
MatSelectModule,
MatDatepickerModule,
MatListModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatExpansionModule,
MatListModule,
MatCardModule,
MatDialogModule,
MatInputModule,
MatProgressSpinnerModule,
HttpClientModule,
AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
RsvpService,
AuthService,
CourseService,
ScorecardService,
EventService,
EventPlayingCountService,
GroupService,
GroupInviteService,
MemberService,
PairingService,
GlobalService,
GroupEventService,
CourseMemberService,
FcmService,
WorkerService,
AngularFireMessaging,
AngularFireFunctions,
Firebase,
provide: RouteReuseStrategy, useClass: IonicRouteStrategy
],
bootstrap: [AppComponent]
)
export class AppModule

pairing-modal.module.ts (modal file)
import NgModule from '@angular/core';
import CommonModule from '@angular/common';
import FormsModule, ReactiveFormsModule from '@angular/forms';
import Routes, RouterModule from '@angular/router';

import IonicModule from '@ionic/angular';

import PairingModalPage from './pairing-modal.page';

const routes: Routes = [

path: '',
component: PairingModalPage

];

@NgModule(
imports: [
CommonModule,
FormsModule,
IonicModule,
ReactiveFormsModule,
RouterModule.forChild(routes)
],
declarations: [PairingModalPage],

)
export class PairingModalPageModule

pairing-modal.page.ts

import FormBuilder, FormControl from '@angular/forms';
import take from 'rxjs/operators';
import Subscription from 'rxjs/Subscription';
import Component from '@angular/core';
import ModalController, NavParams from '@ionic/angular';
import GroupService from '../services/group.service';
import RsvpService from '../services/rsvp.service';
import MemberService from '../services/member.service';

@Component(
selector: 'app-pairing-modal',
templateUrl: './pairing-modal.page.html',
styleUrls: ['./pairing-modal.page.scss'],
)
export class PairingModalPage

subscription: Subscription;
rsvpId: string;
members: any[] = [];
selected: any;

selectForm = this.fb.group(
members: new FormControl(),
);

constructor(
private modalCtrl: ModalController,
private groupService: GroupService,
private memberService: MemberService,
private rsvpService: RsvpService,
private fb: FormBuilder,
private navParams: NavParams,
)

ionViewWillEnter()
this.subscription = new Subscription;
this.rsvpId = this.navParams.get('rsvpId');
const subscription = this.rsvpService.getByDocId(this.rsvpId)
.valueChanges()
.pipe(take(1))
.subscribe((rsvp: any) =>
for (let group of rsvp.event.groups)
const groupSubscription = this.groupService.getByDocId(group)
.valueChanges()
.pipe(take(1))
.subscribe((group: any) =>
for (let member of group.members)
const memberSubscription =
this.memberService.getMemberByDocId(member)
.valueChanges()
.pipe(take(1))
.subscribe((member: any) =>
const tempMember = as any;
tempMember.id = member.id;
tempMember.firstname = member.firstname;
tempMember.lastname = member.lastname;
this.members.push(tempMember);
)
this.subscription.add(memberSubscription);

this.subscription.add(groupSubscription);
)
this.subscription.add(subscription);

)


savePairing()
console.log('this.selected', this.selected);
console.log('this.form', this.selectForm);
this.modalCtrl.dismiss(
members: this.selectForm.value,
);



modal-pairing.page.html

<ion-header>
<ion-toolbar>
<ion-title>pairingModal</ion-title>
</ion-toolbar>
</ion-header>

<ion-content padding>
<form [formGroup]="selectForm" (ngSubmit)="savePairing()">
<ion-item>
<ion-label>Members that are playing</ion-label>
<ion-select multiple="true" cancelText="Cancel" okText="Okay!">
<ion-select-option *ngFor="let member of members"
formControlName="members">

member.firstname member.lastname
</ion-select-option>
</ion-select>
</ion-item>
<ion-button size="small" type="submit" >
<label> Save </label>
</ion-button>
</form>
</ion-content>









share|improve this question














I am trying to use a reactive form in an Ionic Modal. I receive the - Can't bind to formGroup since it isn't a known property of 'form'. (" message. I have seen that this error is typically received when ReactiveFormsModule is not imported. In my case it is imported in the the app.module.ts file and pairing-modal.module.ts file. I am curious if maybe the imports are different when the form is in the modal component. I have also tried to only in the parent file( caller to the modal) with no success.



 app.module.ts:
import PairingModalPage from './pairing-modal/pairing-modal.page';
import WorkerService from './services/worker-service';
import Firebase from '@ionic-native/firebase/ngx';
import AngularFireFunctions from '@angular/fire/functions';
import AngularFireMessaging from '@angular/fire/messaging';
import FcmService from './fcm.service';
import PairingService from './services/pairing-service';
import CourseMemberService from './services/course-member.service';
import NgModule from '@angular/core';
import HttpClientModule from '@angular/common/http';
import BrowserModule from '@angular/platform-browser';
import RouteReuseStrategy from '@angular/router';
import IonicModule, IonicRouteStrategy from '@ionic/angular';
import SplashScreen from '@ionic-native/splash-screen/ngx';
import StatusBar from '@ionic-native/status-bar/ngx';
import BrowserAnimationsModule from '@angular/platform-
browser/animations';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AngularFireModule from '@angular/fire';
import AngularFireDatabaseModule from '@angular/fire/database';
import AngularFireAuthModule from '@angular/fire/auth';
import AngularFirestoreModule from '@angular/fire/firestore';
import environment from './../environments/environment';
import AuthService from './services/auth.service';
import CourseService from './services/course.services';
import EventService from './services/event.service';
import EventPlayingCountService from './services/event-playing-
count.service';
import GroupService from './services/group.service';
import GlobalService from './services/global.service';
import GroupEventService from './services/group-event';
import GroupInviteService from './services/group-invite.service';
import RsvpService from './services/rsvp.service';
import MemberService from './services/member.service';
import MatButtonModule,
MatCheckboxModule,
MatDividerModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatSelectModule,
MatListModule,
MatExpansionModule,
MatDialogModule,
MatCardModule,
MatProgressSpinnerModule
from '@angular/material';
import RsvpDialogComponent from './rsvp-dialog/rsvp-
dialog.component';
import GenDialogComponent from './gen-dialog/gen-dialog.component';
import SpinnerComponent from './spinner/spinner.component';
import ScorecardService from './services/scorecard.service';

@NgModule(
declarations: [ AppComponent, RsvpDialogComponent, GenDialogComponent,
SpinnerComponent, PairingModalPage ],
entryComponents: [
RsvpDialogComponent,
GenDialogComponent,
PairingModalPage,
],
imports: [BrowserModule,
IonicModule.forRoot(),
BrowserAnimationsModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireDatabaseModule,
AngularFireAuthModule,
AngularFirestoreModule,
MatButtonModule,
MatDividerModule,
MatCheckboxModule,
MatFormFieldModule,
MatSelectModule,
MatDatepickerModule,
MatListModule,
MatNativeDateModule,
MatTableModule,
MatTabsModule,
MatExpansionModule,
MatListModule,
MatCardModule,
MatDialogModule,
MatInputModule,
MatProgressSpinnerModule,
HttpClientModule,
AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
RsvpService,
AuthService,
CourseService,
ScorecardService,
EventService,
EventPlayingCountService,
GroupService,
GroupInviteService,
MemberService,
PairingService,
GlobalService,
GroupEventService,
CourseMemberService,
FcmService,
WorkerService,
AngularFireMessaging,
AngularFireFunctions,
Firebase,
provide: RouteReuseStrategy, useClass: IonicRouteStrategy
],
bootstrap: [AppComponent]
)
export class AppModule

pairing-modal.module.ts (modal file)
import NgModule from '@angular/core';
import CommonModule from '@angular/common';
import FormsModule, ReactiveFormsModule from '@angular/forms';
import Routes, RouterModule from '@angular/router';

import IonicModule from '@ionic/angular';

import PairingModalPage from './pairing-modal.page';

const routes: Routes = [

path: '',
component: PairingModalPage

];

@NgModule(
imports: [
CommonModule,
FormsModule,
IonicModule,
ReactiveFormsModule,
RouterModule.forChild(routes)
],
declarations: [PairingModalPage],

)
export class PairingModalPageModule

pairing-modal.page.ts

import FormBuilder, FormControl from '@angular/forms';
import take from 'rxjs/operators';
import Subscription from 'rxjs/Subscription';
import Component from '@angular/core';
import ModalController, NavParams from '@ionic/angular';
import GroupService from '../services/group.service';
import RsvpService from '../services/rsvp.service';
import MemberService from '../services/member.service';

@Component(
selector: 'app-pairing-modal',
templateUrl: './pairing-modal.page.html',
styleUrls: ['./pairing-modal.page.scss'],
)
export class PairingModalPage

subscription: Subscription;
rsvpId: string;
members: any[] = [];
selected: any;

selectForm = this.fb.group(
members: new FormControl(),
);

constructor(
private modalCtrl: ModalController,
private groupService: GroupService,
private memberService: MemberService,
private rsvpService: RsvpService,
private fb: FormBuilder,
private navParams: NavParams,
)

ionViewWillEnter()
this.subscription = new Subscription;
this.rsvpId = this.navParams.get('rsvpId');
const subscription = this.rsvpService.getByDocId(this.rsvpId)
.valueChanges()
.pipe(take(1))
.subscribe((rsvp: any) =>
for (let group of rsvp.event.groups)
const groupSubscription = this.groupService.getByDocId(group)
.valueChanges()
.pipe(take(1))
.subscribe((group: any) =>
for (let member of group.members)
const memberSubscription =
this.memberService.getMemberByDocId(member)
.valueChanges()
.pipe(take(1))
.subscribe((member: any) =>
const tempMember = as any;
tempMember.id = member.id;
tempMember.firstname = member.firstname;
tempMember.lastname = member.lastname;
this.members.push(tempMember);
)
this.subscription.add(memberSubscription);

this.subscription.add(groupSubscription);
)
this.subscription.add(subscription);

)


savePairing()
console.log('this.selected', this.selected);
console.log('this.form', this.selectForm);
this.modalCtrl.dismiss(
members: this.selectForm.value,
);



modal-pairing.page.html

<ion-header>
<ion-toolbar>
<ion-title>pairingModal</ion-title>
</ion-toolbar>
</ion-header>

<ion-content padding>
<form [formGroup]="selectForm" (ngSubmit)="savePairing()">
<ion-item>
<ion-label>Members that are playing</ion-label>
<ion-select multiple="true" cancelText="Cancel" okText="Okay!">
<ion-select-option *ngFor="let member of members"
formControlName="members">

member.firstname member.lastname
</ion-select-option>
</ion-select>
</ion-item>
<ion-button size="small" type="submit" >
<label> Save </label>
</ion-button>
</form>
</ion-content>






ionic-framework angular-reactive-forms ionic4






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 23:09









scott shermanscott sherman

1




1












  • I was able to correct this error by importing FormsModule and ReactiveFormsModule in the app.module.ts file. I don't quite understand why it is needed in the app.module.ts file when the form is on an Ionic Modal Page, but this worked for me.

    – scott sherman
    Mar 8 at 23:27

















  • I was able to correct this error by importing FormsModule and ReactiveFormsModule in the app.module.ts file. I don't quite understand why it is needed in the app.module.ts file when the form is on an Ionic Modal Page, but this worked for me.

    – scott sherman
    Mar 8 at 23:27
















I was able to correct this error by importing FormsModule and ReactiveFormsModule in the app.module.ts file. I don't quite understand why it is needed in the app.module.ts file when the form is on an Ionic Modal Page, but this worked for me.

– scott sherman
Mar 8 at 23:27





I was able to correct this error by importing FormsModule and ReactiveFormsModule in the app.module.ts file. I don't quite understand why it is needed in the app.module.ts file when the form is on an Ionic Modal Page, but this worked for me.

– scott sherman
Mar 8 at 23:27












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072249%2fcant-bind-to-formgroup-since-it-isnt-a-known-property-of-form-ionic-m%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072249%2fcant-bind-to-formgroup-since-it-isnt-a-known-property-of-form-ionic-m%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко