+
+ this.uploader.onBuildItemForm = (item, form) => {
+ form.append('name', this.video.name);
+ form.append('description', this.video.description);
+
+ for (let i = 0; i < this.video.tags.length; i++) {
+ form.append(`tags[${i}]`, this.video.tags[i]);
+ }
+ };
+ }
+
+ onTagKeyPress(event: KeyboardEvent) {
+ // Enter press
+ if (event.keyCode === 13) {
+ // Check if the tag is valid and does not already exist
+ if (
+ this.currentTag !== '' &&
+ this.videoForm.controls['tags'].valid &&
+ this.video.tags.indexOf(this.currentTag) === -1
+ ) {
+ this.video.tags.push(this.currentTag);
+ this.currentTag = '';
+ }
+ }
+ }
+
+ removeFile() {
+ this.uploader.clearQueue();
+ }
+
+ removeTag(tag: string) {
+ this.video.tags.splice(this.video.tags.indexOf(tag), 1);