我试图从一个服务提供的Angular 2中的一个observable中获取一个项目.到目前为止,我可以订阅observable并查看控制台中的内容,但不能通过它的ID过滤掉项目.我在下面尝试了以下内容,但得到一个空白屏幕.任何提示赞赏.
service.ts:
getJobs() {
this.observableData = this._http.get('json_path/')
.map(res => res.json())
.do(val => {
this.result = val;
this.observableData = null;
})
.share();
return this.observableData;
}
Run Code Online (Sandbox Code Playgroud)
component.ts:
let id = this._routeParams.get('id');
this._jobService.getJobs().map(jobs => jobs.filter(item => item.id === id).subscribe(job => this.job = job)[0]);
Run Code Online (Sandbox Code Playgroud) I am trying to make two sibling div elements the same height. The of them has an overflow-y and a scrollbar with variable height content. The main div has content that is also variable height depending on dynamic content and browser width. The main content div should show all its content. The left scrolling panel should be equal height to the main content and no matter the browser width or height of content, hence the scrolling bar.
Previously, I would …