selector: 'my-videos-list',
styleUrls: [ 'client/app/videos/video-list/video-list.component.css' ],
templateUrl: 'client/app/videos/video-list/video-list.component.html',
- directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ]
+ directives: [ LoaderComponent, PAGINATION_DIRECTIVES, ROUTER_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent ]
})
export class VideoListComponent implements OnInit {
- user: User = null;
- videos: Video[] = [];
+ loading = false;
pagination: Pagination = {
currentPage: 1,
itemsPerPage: 9,
total: 0
};
sort: SortField;
- loading = false;
+ user: User = null;
+ videos: Video[] = [];
private search: Search;
constructor(
private authService: AuthService,
- private videoService: VideoService,
+ private router: Router,
private routeParams: RouteParams,
- private router: Router
+ private videoService: VideoService
) {
this.search = {
value: this.routeParams.get('search'),
({ videos, totalVideos }) => {
this.videos = videos;
this.pagination.total = totalVideos;
+
this.loading = false;
},
error => alert(error)
);
}
+ noVideo() {
+ return !this.loading && this.videos.length === 0;
+ }
+
onRemoved(video: Video) {
this.videos.splice(this.videos.indexOf(video), 1);
}
};
if (this.search.value) {
- params.search = this.search.value;
params.field = this.search.field;
+ params.search = this.search.value;
}
this.router.navigate(['VideosList', params]);