0
를 업데이트하지 내 서비스를 여기각도 4 PouchDB 여기에 서비스
export class LunchService {
private db: any;
lunches: any = [];
constructor(
private serverService: ServerService,
private configService: ConfigService,
) {
this.db = new PouchDB(configService.config.dbServer + '/' + configService.config.dbName);
this.db.find({
selector: { 'type': 'lunch' },
}).then((result) => {
// HERE
this.lunches = result.docs;
}).catch(function(err) {
console.log(err);
});
}
}
export class ListingComponent {
lunches: any = [];
constructor(
private lunchService: LunchService
) {
// IS EMPTY WHEN SET IN SERVICE?
this.lunches = this.lunchService.lunches;
}
}
왜 점심 식사 서비스의 변수에 대한 변경은 구성 요소에 반영하지 않습니다 내 compnent이다? 컨트롤러의 점심 파라메터가 채워지지 않습니다.
변경 감지에 있지 않습니까? 그러나 어떻게 작동 시키는가?