EXCEPTION: Error: Uncaught (in promise): Template parse errors: ion-item


#1

Please, help me to solve this problem these are the code
finalis-service.ts
`import {Injectable} from ‘@angular/core’;
import {Http} from ‘@angular/http’;
import ‘rxjs/add/operator/map’;

@Injectable()
export class FinalisService {
  data: any = null;

  constructor(public http: Http) {}

  load() {
    if (this.data) {
      return Promise.resolve(this.data);
    }
    return new Promise(resolve => {
      this.http.get('http://localhost/BGKadmin/index.php/Welcome/Api')
        .map(res => res.json())
        .subscribe(data => {
          this.data = data.results;
          resolve(this.data);
        });
    });
  }
}

`
home.html
<ion-navbar *navbar>

BKG

<ion-content class="home">
    <ion-row><center>Finalis Pemilihan Bujang Gadis Kampus</center></ion-row>
    <ion-list>
        <ion-item *ngFor=#person of finalis">
            <h2>{{person.nomor}}</h2>
        </ion-item>
    </ion-list>
</ion-content>

home.ts
`import {Page, NavController} from ‘ionic-angular’;
import {VotePage} from ‘…/vote/vote’;
import {FinalisService} from ‘…/…/providers/finalis-service/finalis-service’;

@Page({
  templateUrl: 'build/pages/home/home.html',
  providers: [FinalisService]
})
export class HomePage {
    public finalis: any;
  constructor(public nav: NavController, public finalisService: FinalisService) {
    this.loadFinalis();
  }
  
  vote(){
    this.nav.push(VotePage);
  }
  loadFinalis(){
    this.finalisService.load().then(data=> {
        this.finalis =data;
    });
  }
}`

and when ionic serve


#2

The error message is telling you exactly what is wrong. You are missing an opening quote in *ngFor=#person of finalis". Incidentally, that syntax is old and won’t work in recent versions, you need “let person” instead of “#person”.


#3

thank you so much… it’s work