From 98b01bac2c2c4536aa97d826b61516657f4d15f5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Mar 2016 22:16:43 +0100 Subject: Angular 2 : draft 2 --- .../angular/videos/components/add/videos-add.component.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'client/angular/videos/components/add') diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.ts index 97e3bb3b5..8ff6cfec8 100644 --- a/client/angular/videos/components/add/videos-add.component.ts +++ b/client/angular/videos/components/add/videos-add.component.ts @@ -1,9 +1,10 @@ -import {Component, ElementRef, Inject, OnInit} from 'angular2/core'; -import {Router} from 'angular2/router'; -import {NgForm} from 'angular2/common'; +import { Component, ElementRef, Inject, OnInit } from 'angular2/core'; +import { Router } from 'angular2/router'; +import { NgForm } from 'angular2/common'; -import {Video} from '../../models/video'; +import { Video } from '../../models/video'; +// TODO: import it with systemjs declare var jQuery:any; @Component({ @@ -22,9 +23,10 @@ export class VideosAddComponent implements OnInit { ngOnInit() { jQuery(this._elementRef.nativeElement).find('#input_video').fileupload({ + url: '/api/v1/videos', + dataType: 'json', singleFileUploads: true, multipart: true, - url: '/api/v1/videos', autoupload: false, add: (e, data) => { @@ -38,7 +40,8 @@ export class VideosAddComponent implements OnInit { }, done: (e, data) => { - console.log('finished'); + console.log('Video uploaded.'); + // Print all the videos once it's finished this._router.navigate(['VideosList']); } -- cgit v1.2.3