aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/app/app.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-14 13:50:19 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-14 13:50:19 +0100
commitdc8bc31be517a53e8fbe7100cfe45cd73f596de0 (patch)
treec0b0d6641dd352dafff93b8fd33ddb262b59aa47 /client/angular/app/app.component.ts
parentbd324a669218f9ed302f7f54b36ee535d25c9733 (diff)
downloadPeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.gz
PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.zst
PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.zip
Angular application :first draft
Diffstat (limited to 'client/angular/app/app.component.ts')
-rw-r--r--client/angular/app/app.component.ts63
1 files changed, 63 insertions, 0 deletions
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts
new file mode 100644
index 000000000..3d41183f2
--- /dev/null
+++ b/client/angular/app/app.component.ts
@@ -0,0 +1,63 @@
1import { Component, ElementRef } from 'angular2/core';
2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router';
3import {HTTP_PROVIDERS} from 'angular2/http';
4
5import { VideosAddComponent } from '../videos/components/add/videos-add.component';
6import { VideosListComponent } from '../videos/components/list/videos-list.component';
7import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component';
8import { VideosService } from '../videos/services/videos.service';
9import { FriendsService } from '../friends/services/friends.service';
10
11@RouteConfig([
12 {
13 path: '/videos/list',
14 name: 'VideosList',
15 component: VideosListComponent,
16 useAsDefault: true
17 },
18 {
19 path: '/videos/watch/:id',
20 name: 'VideosWatch',
21 component: VideosWatchComponent
22 },
23 {
24 path: '/videos/add',
25 name: 'VideosAdd',
26 component: VideosAddComponent
27 }
28])
29
30@Component({
31 selector: 'my-app',
32 templateUrl: 'app/angular/app/app.component.html',
33 styleUrls: [ 'app/angular/app/app.component.css' ],
34 directives: [ ROUTER_DIRECTIVES ],
35 providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, ElementRef, VideosService, FriendsService ]
36})
37
38export class AppComponent {
39 constructor(private _friendsService: FriendsService) {}
40
41 makeFriends() {
42 this._friendsService.makeFriends().subscribe(
43 status => {
44 if (status === 409) {
45 alert('Already made friends!');
46 }
47 else {
48 alert('Made friends!');
49 }
50 },
51 error => alert(error)
52 )
53 }
54
55 quitFriends() {
56 this._friendsService.quitFriends().subscribe(
57 status => {
58 alert('Quit friends!');
59 },
60 error => alert(error)
61 )
62 }
63}