2016-01-31 9 views
10

ifade beklenen açısal hatats1109: Bu satırını yazarken ben <a href="https://angular.io/docs/ts/latest/guide/router.html" rel="noreferrer">https://angular.io/docs/ts/latest/guide/router.html</a></p> <p>bu örneği takip ediyordu ve ben de bir hizmetle benzer bir liste yapmaya çalışıyorum, ancak nedense

servingpatients = Patient[]; 

Benim bileşenimde, bu hatayı alıyorum, eğer kaldırırsam, işler çalışır. Bunun örnekte ne yapmaya çalıştığından emin değil. konsol hatası: tipleri derleme sırasında

Uncaught SyntaxError: Unexpected token ]

terminali hatası

app/dashboard/dashboard.component.ts(35,27):error TS1109: Expression expected

dashboard.component.ts

import {Component, OnInit} from 'angular2/core'; 
import {Patient, DashboardService} from './dashboard.service'; 
import {Router} from 'angular2/router'; 
export class DashboardComponent implements OnInit{ 

servingpatients = Patient[]; 

    constructor(private _service : DashboardService, 
    private _router: Router){} 


    ngOnInit(){ 
    this._service.getServingPatients().then(servingpatients => this.servingpatients = servingpatients) 
    } 

} 

cevap

27

hata hattı (35,27) diyor ama sadece görebilirsiniz Dashboard.component.ts içinde 11 satır.

Komut dosyanızı inceleyerek, tek sorun burada. Sen kolona "Hasta"

servingpatients = Patient[]; 

eşit değiştirin (=) dizisi olarak "servingpatients" için türünü tanımlayan (:) tip

servingpatients : Patient[]; 
+0

Evet olmasıydı sorunu tanımlamak için, dın Farketme. Teşekkürler. –