in Education by
I have this template that I used everywhere in my project :

{{ event.title }}

{{ event.content }}

I uses many properties : title, content, etc.. I have structured my project like this : events-list.component.ts that displays the list of the events and events-get.component.ts that is the detail of an event. In the details of an event, I also display other events (such as the "you may also like" bloc). I do not where and how to declare a "template" that i could use instead of duplicating this code. Something like but with the possibility of passing the properties. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Thanks to the comments, I succeed to achieve what I wanted. I created a new component called event. I now have a event.component.ts : import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-event', templateUrl: './event.component.html', styleUrls: ['./event.component.css'] }) export class EventComponent implements OnInit { @Input() event: Event; constructor() { } ngOnInit() { } } I set the template of this component as the one that I want to reuse everywhere. Then, in my events-list.component.ts, I can use : It is perfect !

Related questions

0 votes
    I have this template that I used everywhere in my project : {{ event.title }} {{ event.content } ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I need to create an new link from the current route: https://website.com/post/99 = curent browser ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I need to create an new link from the current route: https://website.com/post/99 = curent browser ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I have these routes /items/:id /items /items/:id/edit ... etc I want to put the component, to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I have a mat-table with a component app-order-statuses on every row. the component calls the statuses ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I have an angular 7 project and I'm using Angular universal. Everything is working fine except when I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 30, 2022 in Education by JackTerrance
0 votes
    I have these routes /items/:id /items /items/:id/edit ... etc I want to put the component, to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have a simple submit method, where Console.log(11) is printed first then console.log(1). I need ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 22, 2022 in Education by JackTerrance
0 votes
    I have a simple submit method, where Console.log(11) is printed first then console.log(1). I need ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    I create an angular library "mylib" I create a service which uses BehaviorSubject Observable from rxjs. For ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I'm using Angular Material in my application. I have input fields like this: E-mail Which produces a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I'm using Angular Material in my application. I have input fields like this: E-mail Which produces a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have a json file contains a icons object like this: "icons" : { "logo" : "fa fa-caret-down ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    ______________ are JS functions that you can call from your templates, and encourage you to reuse code and build complex templates a)Expressions b)Helpers c)Template d)Context...
asked Apr 29, 2021 in Technology by JackTerrance
0 votes
    so with ng2 rc.6 I am getting an error of: Uncaught (in promise) Error: (SystemJS) SyntaxError: ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
...