Struggling to figure this out, I am attempting to dynamically add user video data that includes a video URL. My goal is to access the data from the component so I can use it in my HTML. I've attempted the following approach.
app.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-video',
templateUrl: './video.component.html',
styleUrls: ['./video.component.scss'],
providers: [
DashboardServiceProxy
]
})
export class VideoComponent implements OnInit {
videos: UserVideoDto[] = [];
// videos: Array<UserVideoDto> = [];
constructor(
private _dashboardService: DashboardServiceProxy
) {
console.log(this.videos.VideoData); //data im trying to access
}
ngOnInit() {
this.getVideos();
}
getVideos() {
this._dashboardService.getAllUserVideos().subscribe((result) => {
this.videos = result;
console.log(this.videos);
});
}
}
Currently, I'm just trying to log the data but encountering an error indicating
[ts] Property 'videoData' does not exist on type 'UserVideoDto[]'
Check out the UserVideoDto[] class below
public class UserVideoDto : EntityDto
{
public long UserId { get; set; }
public DateTime CreationTime { get; set; }
public int TenantId { get; set; }
public string VideoData { get; set; }
public string Thumbnail { get; set; }
public String Name { get; set; }
public String Series { get; set; }
public String Subname { get; set; }
public UserVideoDto()
{ }
}
If you have any insights or solutions, your help would be greatly appreciated.