mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Angular 2 : draft 2
This commit is contained in:
parent
dc8bc31be5
commit
98b01bac2c
13 changed files with 82 additions and 31 deletions
|
@ -1,6 +1,6 @@
|
|||
import { Component, ElementRef } from 'angular2/core';
|
||||
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router';
|
||||
import {HTTP_PROVIDERS} from 'angular2/http';
|
||||
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from 'angular2/router';
|
||||
import { HTTP_PROVIDERS } from 'angular2/http';
|
||||
|
||||
import { VideosAddComponent } from '../videos/components/add/videos-add.component';
|
||||
import { VideosListComponent } from '../videos/components/list/videos-list.component';
|
||||
|
@ -36,15 +36,22 @@ import { FriendsService } from '../friends/services/friends.service';
|
|||
})
|
||||
|
||||
export class AppComponent {
|
||||
constructor(private _friendsService: FriendsService) {}
|
||||
constructor(private _friendsService: FriendsService, private _router: Router) {}
|
||||
|
||||
doSearch(search: string) {
|
||||
if (search !== '') {
|
||||
this._router.navigate(['VideosList', { search: search }]);
|
||||
} else {
|
||||
this._router.navigate(['VideosList']);
|
||||
}
|
||||
}
|
||||
|
||||
makeFriends() {
|
||||
this._friendsService.makeFriends().subscribe(
|
||||
status => {
|
||||
if (status === 409) {
|
||||
alert('Already made friends!');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
alert('Made friends!');
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue