Skip to content

Commit

Permalink
fix(aio): Treating some deprecated (angular#27981)
Browse files Browse the repository at this point in the history
PR Close angular#27981
  • Loading branch information
wKoza authored and AndrewKushnir committed Jan 9, 2019
1 parent d2b2d81 commit c7346bf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
20 changes: 12 additions & 8 deletions aio/src/app/custom-elements/api/api-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? = '';
Expand Down Expand Up @@ -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();
}
Expand Down
20 changes: 11 additions & 9 deletions aio/src/app/navigation/navigation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion aio/src/app/shared/scroll-spy.service.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion aio/src/app/shared/scroll.service.spec.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion aio/src/app/shared/scroll.service.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit c7346bf

Please sign in to comment.