This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/components/linktext/linktext.component.ts | |
import { Component, OnInit, Input } from '@angular/core'; | |
@Component({ | |
selector: 'app-linktext', | |
templateUrl: './linktext.component.html', | |
styleUrls: ['./linktext.component.css'] | |
}) | |
export class LinktextComponent implements OnInit { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/app/components/points/points.component.html | |
<a href="#" class="label label-success link-black btn btn-sm"> | |
<i class="fa fa-gift margin-r-5"></i> Points ({{points}}) | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/app/components/points/points.component.ts | |
import { Component, OnInit, Input } from '@angular/core'; | |
@Component({ | |
selector: 'app-points', | |
templateUrl: './points.component.html', | |
styleUrls: ['./points.component.css'] | |
}) | |
export class PointsComponent implements OnInit { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/spp/components/link/link.component.html | |
<!-- Post --> | |
<div class="post"> | |
<app-linktext [titletext]='article.title' [linktext]='article.link'> </app-linktext> | |
<app-votelink [points]='article.points' (upvote)='upvote($event)' (downvote)='downvote($event)'></app-votelink> | |
<hr /> | |
</div> | |
<!-- /.post --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/spp/components/link/link.component.ts | |
import { Component, OnInit, Input } from '@angular/core'; | |
import * as fromArticle from '../../redux/reducer' | |
import * as fromAction from '../../redux/actions/articles' | |
import { Article } from '../../redux/models/article'; | |
import { Store } from '@ngrx/store' | |
@Component({ | |
selector: 'app-link', | |
templateUrl: './link.component.html', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fromArticle from '../../redux/reducer' | |
import * as fromAction from '../../redux/actions/articles' | |
import { Article } from '../../redux/models/article'; | |
import { Store } from '@ngrx/store' | |
//inject the Store inside your components constructor | |
constructor(private store: Store<fromArticle.State>) { } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-linktext [titletext]='article.title' [linktext]='article.link'> </app-linktext> | |
<app-votelink [points]='article.points' (upvote)='upvote($event)' (downvote)='downvote($event)'></app-votelink> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upvote = () => { | |
this.store.dispatch(new fromAction.IncrementArticlePointAction(this.article)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
downvote = () => { | |
this.store.dispatch(new fromAction.DecrementArticlePointAction(this.article)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/app/components/linklist/linklist.component.ts | |
import { Component, OnInit, Input } from '@angular/core'; | |
import { Article } from '../../redux/models/article'; | |
@Component({ | |
selector: 'app-linklist', | |
templateUrl: './linklist.component.html', | |
styleUrls: ['./linklist.component.css'] | |
}) | |
export class LinklistComponent implements OnInit { |