From c7346bfdbad2a382b96d446e9ce5f349bde56d0b Mon Sep 17 00:00:00 2001 From: WilliamKoza Date: Tue, 8 Jan 2019 13:35:59 +0100 Subject: [PATCH] fix(aio): Treating some deprecated (#27981) PR Close #27981 --- .../custom-elements/api/api-list.component.ts | 20 +++++++++++-------- aio/src/app/navigation/navigation.service.ts | 20 ++++++++++--------- aio/src/app/shared/scroll-spy.service.spec.ts | 2 +- aio/src/app/shared/scroll.service.spec.ts | 2 +- aio/src/app/shared/scroll.service.ts | 2 +- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/aio/src/app/custom-elements/api/api-list.component.ts b/aio/src/app/custom-elements/api/api-list.component.ts index 71d242a2d2..8711cf80e8 100644 --- a/aio/src/app/custom-elements/api/api-list.component.ts +++ b/aio/src/app/custom-elements/api/api-list.component.ts @@ -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(); } diff --git a/aio/src/app/navigation/navigation.service.ts b/aio/src/app/navigation/navigation.service.ts index ff08b2bf11..87bd602763 100644 --- a/aio/src/app/navigation/navigation.service.ts +++ b/aio/src/app/navigation/navigation.service.ts @@ -91,17 +91,19 @@ export class NavigationService { */ private getCurrentNodes(navigationViews: Observable): Observable { 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).connect(); return currentNodes; } diff --git a/aio/src/app/shared/scroll-spy.service.spec.ts b/aio/src/app/shared/scroll-spy.service.spec.ts index 675d1190d3..c2d2ed7be7 100644 --- a/aio/src/app/shared/scroll-spy.service.spec.ts +++ b/aio/src/app/shared/scroll-spy.service.spec.ts @@ -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'; diff --git a/aio/src/app/shared/scroll.service.spec.ts b/aio/src/app/shared/scroll.service.spec.ts index 75dd14120b..90ff2d3cb5 100644 --- a/aio/src/app/shared/scroll.service.spec.ts +++ b/aio/src/app/shared/scroll.service.spec.ts @@ -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'; diff --git a/aio/src/app/shared/scroll.service.ts b/aio/src/app/shared/scroll.service.ts index 764433b747..22ae8ef8e2 100644 --- a/aio/src/app/shared/scroll.service.ts +++ b/aio/src/app/shared/scroll.service.ts @@ -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;