import {Component, Input, ElementRef} from '@angular/core'; @Component({ selector: 'publishedIn', template: `
Published in
{{key}} [{{i+1}}] {{key}} {{key}}
View less
...
View more
` }) export class PublishedInComponent { //key is name @Input() publishedIn: Map; public showAll: boolean = false; constructor (private element: ElementRef) {} ngOnInit() {} public scroll() { console.info("scroll into view"); if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); } } public getKeys( map) { return Array.from(map.keys()); } }