patch test Signal use
This commit is contained in:
@@ -1,19 +1,43 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {VideoService} from '../../../_services/video.service';
|
||||
import {Video} from '../../../_models/video';
|
||||
import {DatePipe} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
imports: [],
|
||||
imports: [
|
||||
DatePipe
|
||||
],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrl: './home.component.css'
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
constructor(private title: Title) {
|
||||
videos: Video[] = []
|
||||
|
||||
constructor(private title: Title, private videoService: VideoService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.title.setTitle('Accueil - YouVideo');
|
||||
this.videoService.getVideo().subscribe(v => {
|
||||
this.videos = v.data;
|
||||
})
|
||||
}
|
||||
|
||||
generatorLink() {
|
||||
const baseId = 'qiSOyusTaeo';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
||||
const length = 11;
|
||||
|
||||
let randomPart = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
randomPart += characters.charAt(randomIndex);
|
||||
}
|
||||
|
||||
return `https://youtube.com/watch?v=${randomPart}`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user