so here is the condition
I'm making multi template driven form, if satisfied then ionic-slide will 
trigger next.

which mean i had to pass the value of `#currentForm="ngForm"` to the TS 
function `submitForm(#currentForm)` then check if `currentForm.valid` in 
the ts

problem is that, i cannot make any dynamic ID #anotherForm, #anotherForm2 
because of angular syntax hence i must rewrite all other forms

do you have any sugestion how to make it DRY

i have an idea to `submitForm($event)` and cast event as NgForm but cannot


```html

  <ion-slide >
          <h2>{{this.vechileForm.title}}</h2>
            <form class="ionContent" #idVechileForm="ngForm"  
(submit)="completionFormSubmit(idVechileForm)">
              <ion-list *ngFor="let currentBaseForm of 
this.vechileForm.baseForms" >
                    <floating-input [parentForm]="idVechileForm" 
[baseForm]="currentBaseForm"></floating-input>
              </ion-list>

              <button  ion-button=""  type="button" 
(click)="slidePrevious()" color="light">Previous</button>
              <button  ion-button=""  color="primary">Next</button>
            </form>
        </ion-slide>

        <ion-slide >

          <h2>{{hostForm.title}}</h2>
          <form class="ionContent" #idHostForm="ngForm"  
(submit)="completionFormSubmit(idHostForm)">
            <ion-list *ngFor="let currentBaseForm of hostForm.baseForms">
              <floating-input  [parentForm]="idHostForm" 
[baseForm]="currentBaseForm"></floating-input>
            </ion-list>
            <button  ion-button=""  type="button" (click)="slidePrevious()" 
color="light">Previous</button>
            <button  ion-button="" color="primary">Submit</button>
          </form>
        </ion-slide>

```

```javascript

  completionFormSubmit(form: NgForm) {
    if (form.valid) {
      this.slideNext();
      for(var key in form.value){
        console.log('sdfsdfdsfsd');
        this.formValues[key] = form.value[key];
      }
    }
    else {
      this.alert("Field(s) is not valid");
    }


  }
```

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to