Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class Article {
- id: number;
- description: string;
- public getShortDescription() : string {
- return this.description.substr(0, 255);
- }
- }
- import {Component, Input, OnInit} from '@angular/core';
- import {Article} from "../models/article";
- @Component({
- selector: 'article-preview',
- templateUrl: './article-preview.component.html',
- })
- export class AnimeGridComponent implements OnInit{
- ngOnInit(): void {
- this.text = this.article.getShortDescription();
- }
- @Input() article: Article;
- text: string;
- }
- <div>
- <article-preview ngFor="let article of articles" [article]="article"></<article-preview>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement