refactor(docs-infra): remove unused functions in resources component page (#34756)
In resources component there were unused functions removed unused funtions PR Close #34756
This commit is contained in:
parent
fcfce99e9e
commit
7431206247
@ -1,5 +1,4 @@
|
|||||||
import { Component, HostListener, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PlatformLocation } from '@angular/common';
|
|
||||||
|
|
||||||
import { Category } from './resource.model';
|
import { Category } from './resource.model';
|
||||||
import { ResourceService } from './resource.service';
|
import { ResourceService } from './resource.service';
|
||||||
@ -13,26 +12,15 @@ export class ResourceListComponent implements OnInit {
|
|||||||
|
|
||||||
categories: Category[];
|
categories: Category[];
|
||||||
location: string;
|
location: string;
|
||||||
scrollPos = 0;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
location: PlatformLocation,
|
|
||||||
private resourceService: ResourceService) {
|
private resourceService: ResourceService) {
|
||||||
this.location = location.pathname.replace(/^\/+/, '');
|
this.location = location.pathname.replace(/^\/+/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
href(cat: {id: string}) {
|
|
||||||
return this.location + '#' + cat.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// Not using async pipe because cats appear twice in template
|
// Not using async pipe because cats appear twice in template
|
||||||
// No need to unsubscribe because categories observable completes.
|
// No need to unsubscribe because categories observable completes.
|
||||||
this.resourceService.categories.subscribe(cats => this.categories = cats);
|
this.resourceService.categories.subscribe(cats => this.categories = cats);
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('window:scroll', ['$event.target'])
|
|
||||||
onScroll(target: any) {
|
|
||||||
this.scrollPos = target ? target.scrollTop || target.body.scrollTop || 0 : 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user