rxjs - Angular 2 don't dectect change on an Observable -


i develop application angular 2.
have problem dectection change in angular.
explain :
have component:

test.component.ts

@component({   selector: 'test',   template: `   <h1> observable </h1>   <p *ngfor="let exam of listeexamen"> {{exam.patient.name}}</p>   <button (click)="test()">push</button>   ` }) export class testcomponent implements oninit{   listeexamen: examen[];    constructor(public rechercheservice: rechercheservice){     this.listeexamen = [];   }   ngoninit(){     this.rechercheservice.retrievestudies()       .subscribe((resultat) => {         let patient = this.getpatient(resultat);         let study = this.getstudy(resultat);         this.listeexamen = this.listeexamen.concat([new examen(patient, study)]);       });   }   test(){     console.log(this.listeexamen);   } } 

this component call service method request server result observable :

recherche.service.ts

@injectable() export class rechercheservice{   private champ;   private resultatrecherche;   private dicom;   private client;   private services;    constructor(){       this.champ = inforecherche;       this.dicom = require("./app/dicomrequest/dicom.js");       this.client = this.dicom.loadclient('localhost',       11112, 'findscu', 'dcm4chee');       this.services = this.dicom.loadservices();       this.client.on('error', () => {         console.log("erreur de connexion");       });   }   retrievestudies(): observable<any>{     return new observable<any>(observer => {       this.client.connect( () => {         let cfind = new this.services.cfind();         this.client.addservice(cfind);           let studyids = [];           cfind.retrievestudies(this.champ,           [(result) => {             observer.next(result);           }]);         });     }); } 

the retrievestudies method stack result , component convert , stack result in listeexamen. tab bind template of component. observable make job , stack results in tab.

problem angular don't update view.

result after observable job: enter image description here



result after click on "appuie" : enter image description here

result appear in view after emit user's event.
how update view automaticaly?

thanks.


Comments