Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. export class Article {
  2. id: number;
  3. description: string;
  4. public getShortDescription() : string {
  5. return this.description.substr(0, 255);
  6. }
  7. }
  8.  
  9. import {Component, Input, OnInit} from '@angular/core';
  10. import {Article} from "../models/article";
  11.  
  12. @Component({
  13. selector: 'article-preview',
  14. templateUrl: './article-preview.component.html',
  15. })
  16. export class AnimeGridComponent implements OnInit{
  17. ngOnInit(): void {
  18. this.text = this.article.getShortDescription();
  19. }
  20. @Input() article: Article;
  21. text: string;
  22. }
  23.  
  24. <div>
  25. <article-preview ngFor="let article of articles" [article]="article"></<article-preview>
  26. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement