socialnetworknews-web

A open-source Paper.li clone
git clone git://archive.git.mtrnord.blog/SocialNetworkNews/socialnetworknews-web.git
Log | Files | Refs | README | LICENSE

commit 21d90c9ea00dbf25d52711e763659eb941378f57
parent 842cb22db0a1eb817f229b91152d869c9bd90503
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sun, 18 Mar 2018 19:13:36 +0100

fix goTo() function

Diffstat:
Msrc/app/tweet-list/tweet-list.component.html | 6+++---
Msrc/app/tweet-list/tweet-list.component.ts | 11++---------
2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/app/tweet-list/tweet-list.component.html b/src/app/tweet-list/tweet-list.component.html @@ -1,5 +1,5 @@ <div #container class="grid"> - <article *ngFor="let item of data; let i = index"> + <article *ngFor="let item of data"> <!--<a href="{{item.tweet_link}}">--> <!--Retweet Badge--> <div class="ribbon ribbon-top-left" *ngIf="item.retweet == true" style="max-width: 22rem"> @@ -8,12 +8,12 @@ </span> </div> <div style="z-index: 2;"> - <a (click)="goTo(lightboxItem, i)" > + <a (click)="goTo(lightboxItem)" > <img *ngIf="item.image_urls && item.image_urls[0]" [src]="item.image_urls[0]" class="thumbnail"> </a> <!-- lightbox container hidden with CSS --> - <a href="#_" class="lightbox" id="#{{i}}" #lightboxItem> + <a href="#_" class="lightbox" #lightboxItem> <img src="http://insomnia.rest/images/screens/main.png"> </a> diff --git a/src/app/tweet-list/tweet-list.component.ts b/src/app/tweet-list/tweet-list.component.ts @@ -31,15 +31,8 @@ export class TweetListComponent implements OnInit { }); } - public goTo(el: any, which: string): void { - console.log(el) - console.log(typeof el) - el.forEach((value: ElementRef, index: number, array: ElementRef[]) => { - if (value.nativeElement.id === which) { - console.log(value); - value.nativeElement.scrollIntoView(); - } - }); + public goTo(el: HTMLAnchorElement): void { + el.scrollIntoView(); } ngOnInit() {