fix(aio): Treating some deprecated (#27981)

PR Close #27981
This commit is contained in:
WilliamKoza 2019-01-08 13:35:59 +01:00 committed by Andrew Kushnir
parent d2b2d813d5
commit c7346bfdba
5 changed files with 26 additions and 20 deletions

View File

@ -14,6 +14,7 @@ import { LocationService } from 'app/shared/location.service';
import { ApiSection, ApiService } from './api.service';
import { Option } from 'app/shared/select/select.component';
import { map } from 'rxjs/operators';
class SearchCriteria {
query ? = '';
@ -67,14 +68,17 @@ export class ApiListComponent implements OnInit {
private locationService: LocationService) { }
ngOnInit() {
this.filteredSections = combineLatest(
this.apiService.sections,
this.criteriaSubject,
(sections, criteria) => {
return sections
.map(section => ({ ...section, items: this.filterSection(section, criteria) }));
}
);
this.filteredSections =
combineLatest(
this.apiService.sections,
this.criteriaSubject
).pipe(
map( results => ({ sections: results[0], criteria: results[1]})),
map( results => (
results.sections
.map(section => ({ ...section, items: this.filterSection(section, results.criteria) }))
))
);
this.initializeSearchCriteria();
}

View File

@ -91,17 +91,19 @@ export class NavigationService {
*/
private getCurrentNodes(navigationViews: Observable<NavigationViews>): Observable<CurrentNodes> {
const currentNodes = combineLatest(
navigationViews.pipe(map(views => this.computeUrlToNavNodesMap(views))),
this.location.currentPath,
(navMap, url) => {
const matchSpecialUrls = /^api/.exec(url);
navigationViews.pipe(
map(views => this.computeUrlToNavNodesMap(views))),
this.location.currentPath,
).pipe(
map((result) => ({navMap: result[0] , url: result[1]})),
map((result) => {
const matchSpecialUrls = /^api/.exec(result.url);
if (matchSpecialUrls) {
url = matchSpecialUrls[0];
result.url = matchSpecialUrls[0];
}
return navMap.get(url) || { '' : { view: '', url: url, nodes: [] }};
})
.pipe(publishReplay(1));
return result.navMap.get(result.url) || { '' : { view: '', url: result.url, nodes: [] }};
}),
publishReplay(1));
(currentNodes as ConnectableObservable<CurrentNodes>).connect();
return currentNodes;
}

View File

@ -1,6 +1,6 @@
import { Injector, ReflectiveInjector } from '@angular/core';
import { fakeAsync, tick } from '@angular/core/testing';
import { DOCUMENT } from '@angular/platform-browser';
import { DOCUMENT } from '@angular/common';
import { ScrollService } from 'app/shared/scroll.service';
import { ScrollItem, ScrollSpiedElement, ScrollSpiedElementGroup, ScrollSpyService } from 'app/shared/scroll-spy.service';

View File

@ -1,6 +1,6 @@
import { ReflectiveInjector } from '@angular/core';
import { PlatformLocation } from '@angular/common';
import { DOCUMENT } from '@angular/platform-browser';
import { DOCUMENT } from '@angular/common';
import { ScrollService, topMargin } from './scroll.service';

View File

@ -1,6 +1,6 @@
import { Injectable, Inject } from '@angular/core';
import { PlatformLocation } from '@angular/common';
import { DOCUMENT } from '@angular/platform-browser';
import { DOCUMENT } from '@angular/common';
import { fromEvent } from 'rxjs';
export const topMargin = 16;