2017-01-31 4 views
0

Ich habe ein Problem. Mein Service gibt ein Objekt mit mehr Array zurück, ich sende Navaramps für meine Seite ein und abonniere, aber auf meiner Seite gibt es beobachtbare, ich benutze nicht beobachtbar.eckig2 - Service gibt eine beobachtbare in abonnieren

Wie löste das?

Service

getInfoAccountById(id: any) { 
    this.module = 'accounts/' + id + '/infos'; 
    let headers = new Headers(); 
    headers.append(this.key, this.token); 

    return this.http.get(this.url + this.module, { 
     headers 
    }).map(res => res.json().Result) 


} 

primäre Seite nav params

constructor(public navCtrl: NavController, public navParams: NavParams, public acc: AccountService) { 
    this.navParams = navParams; 


    this.dataDetails = { 
     id: this.navParams.get('data').Id, 
     name: this.navParams.get('data').Identification, 
     complement: this.navParams.get('data').Complement, 
     account: this.navParams.get('data').AccountType.Identification, 
     pricelist: this.navParams.get('data').PriceList, 
     active: this.navParams.get('data').Active, 
     color:this.acc.getdetailsAccountById(this.navParams.get('data').Id).subscribe(data => { this.datad = data.Color; }), 
      informations:this.acc.getInfoAccountById(this.navParams.get('data').Id) // this line have a problem 



     }; 


    } 

sekundäre Seite params recevied

constructor(public navCtrl: NavController, public navParams: NavParams, public acc: AccountService, public http: Http) { 

    this.id = this.navParams.data.id; 
    this.name = this.navParams.data.name; 
    this.complement = this.navParams.data.complement; 
    this.account = this.navParams.data.account; 
    this.pricelist = this.navParams.data.pricelist; 
    this.active = this.navParams.data.active; 
    this.color = this.navParams.data.color; 
    this.infos = this.navParams.data.informations; 
    console.log(this.infos); 

} 
+0

Wie haben Sie Observables verwaltet? –

+0

Ich verwende keine Observables –

Antwort

0

Sie zeichnen einfach eingestellt innerhalb müssen.

constructor(public navCtrl: NavController, public navParams: NavParams, public acc: AccountService) { 
    this.navParams = navParams; 


    this.dataDetails = { 
     id: this.navParams.get('data').Id, 
     name: this.navParams.get('data').Identification, 
     complement: this.navParams.get('data').Complement, 
     account: this.navParams.get('data').AccountType.Identification, 
     pricelist: this.navParams.get('data').PriceList, 
     active: this.navParams.get('data').Active, 
     color:'', 
     information:'' 
     }; 
this.acc.getdetailsAccountById(this.navParams.get('data').Id).subscribe(data => { this.dataDetails.color = data.Color; }) 
this.acc.getInfoAccountById(this.navParams.get('data').Id).subscribe(data=> this.dataDetails.information = data; 
    } 
+0

nicht funktionieren, zurück abonnieren –

Verwandte Themen