aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-add/video-add.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/video-add/video-add.component.ts')
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/client/src/app/videos/video-add/video-add.component.ts b/client/src/app/videos/video-add/video-add.component.ts
index c0f8cb9c4..900ef1da3 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -1,5 +1,6 @@
1import { Control, ControlGroup, Validators } from '@angular/common'; 1import { Validators } from '@angular/common';
2import { Component, ElementRef, OnInit } from '@angular/core'; 2import { Component, ElementRef, OnInit } from '@angular/core';
3import { FormControl, FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms';
3import { Router } from '@angular/router'; 4import { Router } from '@angular/router';
4 5
5import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; 6import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
@@ -12,14 +13,14 @@ import { AuthService } from '../../shared';
12 selector: 'my-videos-add', 13 selector: 'my-videos-add',
13 styles: [ require('./video-add.component.scss') ], 14 styles: [ require('./video-add.component.scss') ],
14 template: require('./video-add.component.html'), 15 template: require('./video-add.component.html'),
15 directives: [ FileSelectDirective, PROGRESSBAR_DIRECTIVES ], 16 directives: [ FileSelectDirective, PROGRESSBAR_DIRECTIVES, REACTIVE_FORM_DIRECTIVES ],
16 pipes: [ BytesPipe ] 17 pipes: [ BytesPipe ]
17}) 18})
18 19
19export class VideoAddComponent implements OnInit { 20export class VideoAddComponent implements OnInit {
20 currentTag: string; // Tag the user is writing in the input 21 currentTag: string; // Tag the user is writing in the input
21 error: string = null; 22 error: string = null;
22 videoForm: ControlGroup; 23 videoForm: FormGroup;
23 uploader: FileUploader; 24 uploader: FileUploader;
24 video = { 25 video = {
25 name: '', 26 name: '',
@@ -70,10 +71,10 @@ export class VideoAddComponent implements OnInit {
70 } 71 }
71 72
72 ngOnInit() { 73 ngOnInit() {
73 this.videoForm = new ControlGroup({ 74 this.videoForm = new FormGroup({
74 name: new Control('', Validators.compose([ Validators.required, Validators.minLength(3), Validators.maxLength(50) ])), 75 name: new FormControl('', [ <any>Validators.required, <any>Validators.minLength(3), <any>Validators.maxLength(50) ]),
75 description: new Control('', Validators.compose([ Validators.required, Validators.minLength(3), Validators.maxLength(250) ])), 76 description: new FormControl('', [ <any>Validators.required, <any>Validators.minLength(3), <any>Validators.maxLength(250) ]),
76 tags: new Control('', Validators.pattern('^[a-zA-Z0-9]{2,10}$')) 77 tags: new FormControl('', <any>Validators.pattern('^[a-zA-Z0-9]{2,10}$'))
77 }); 78 });
78 79
79 80