0

Here is my component where i am loading video id in i tag on click event. I want to access this id from video.component.ts file. And want to load new video dynamically. I can't figure out how to load it.

<li *ngFor="let video of chapter.video" 
    class="list-group-item hoverEffect">
     <a 
     routerLink="video/{{ video.ytd }}" class="linkHover">
     <i 
     (click)="loadVideo({{ video.id }})" class="fa fa-play-circle float-right"></i>
                      {{ video.title }}
     </a>
</li>

this is function in my ts file

  loadVideo(video: any){
    this.player = video;
  }
1

1 Answer 1

1

Remove the interpolation:

<li *ngFor="let video of chapter.video" 
    class="list-group-item hoverEffect">
     <a 
     routerLink="video/{{ video.ytd }}" class="linkHover">
     <i 
     ̶(̶c̶l̶i̶c̶k̶)̶=̶"̶l̶o̶a̶d̶V̶i̶d̶e̶o̶(̶{̶{̶ ̶v̶i̶d̶e̶o̶.̶i̶d̶ ̶}̶}̶)̶"̶ ̶c̶l̶a̶s̶s̶=̶"̶f̶a̶ ̶f̶a̶-̶p̶l̶a̶y̶-̶c̶i̶r̶c̶l̶e̶ ̶f̶l̶o̶a̶t̶-̶r̶i̶g̶h̶t̶"̶
     (click)="loadVideo(video.id)" class="fa fa-play-circle float-right">
     </i>
                      {{ video.title }}
     </a>
</li>
Sign up to request clarification or add additional context in comments.

1 Comment

I'm stealing that idea! :-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.