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 25271ce32666bf80be545b55c6c0e717ae4334c3
parent 7dad046ed3e21eb06b5036fe8d1ef6a79004d5b5
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue, 27 Mar 2018 17:26:22 +0200

Make innerHTML and META working

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

diff --git a/src/app/tweet-list/tweet-list.component.html b/src/app/tweet-list/tweet-list.component.html @@ -23,7 +23,7 @@ </div> </a> <mat-card-content> - <p [innerHtml]="item.text | linkify"></p> + <div [innerHTML]="item.text | linkify"></div> <br> <i class="fa fa-heart">&nbsp;</i>{{item.favorites.toLocaleString()}}&nbsp;<i class="fa fa-retweet">&nbsp;</i>{{item.retweets.toLocaleString()}} </mat-card-content> diff --git a/src/app/tweet-list/tweet-list.component.ts b/src/app/tweet-list/tweet-list.component.ts @@ -43,16 +43,6 @@ export class TweetListComponent implements OnInit { // Get API this.getYesterday(); this.getPaper(); - - // Set Meta Tags - this.metaService.addTags([ - { name: 'og:title', content: this.paperData.name }, - { name: 'og:description', content: this.paperData.description }, - { name: 'og:image', content: this.paperData.paper_image }, - { name: 'description', content: this.paperData.description }, - { name: 'author', content: this.paperData.author.username }, - ]); - this.titleService.setTitle( this.paperData.name ); } getPaper() { this.apiService.getPaper(this.uuid) @@ -72,7 +62,18 @@ export class TweetListComponent implements OnInit { .concat(Observable.throw({error: 'Sorry, there was an error (after 5 retries). This probably means we can\'t reach our API Server :('})); }) .subscribe( - data => { this.paperData = data; }, + data => { + this.paperData = data; + // Set Meta Tags + this.metaService.addTags([ + { name: 'og:title', content: this.paperData.name }, + { name: 'og:description', content: this.paperData.description }, + { name: 'og:image', content: this.paperData.paper_image }, + { name: 'description', content: this.paperData.description }, + { name: 'author', content: this.paperData.author.username }, + ]); + this.titleService.setTitle( this.paperData.name ); + }, err => { this.toastr.error(err['error'], 'Error connecting API', { positionClass: 'toast-top-center',