Unexpected closing tag ion-list in ionic 3

2019-08-25 06:58发布

问题:

I checked many times and didn't see any problem. It throws an error for a closing tag of ion-list inside HTML.

Component

<div>
  <button (click)="toggleFunc();" class="accordion">Section Title</button>
  <div class="panel" [ngClass]="opened ? 'active' : ''">
    <form  [formGroup]="form">
      <ion-list style="margin-top: 15% !important" class="scroll">
        <ion-item>
            <ion-input class="input-field" formControlName="firstName" name="firstName" type="text" placeholder="First Name"></ion-input>
          </ion-item>
     ...
     ...
              <button ion-button block class="login-button" (click)="search(form.value)">Search</button>                
      </ion-list>
  </form>
  </div>
</div>

Page

<ion-content>
<app-search></app-search>
  <div class="group">
    <ion-grid>
...
    </ion-grid>
  </div>
</ion-content>

Problem is coming from search component's HTML. What is wrong? And how can be it fixed?

回答1:

I am not sure what exactly the problem is. De facto, you provide two templates above. I created a small demo which I think represents exactly what you are looking for. Take a look at it here ;)

https://stackblitz.com/edit/ionic-accordion

Do not forget to upvote if it helps. Cheers!