-
Notifications
You must be signed in to change notification settings - Fork 121
/
Copy pathapp.ts
56 lines (49 loc) · 1.4 KB
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Angular 2 decorators and services
*/
import {Component} from 'angular2/core';
import {RouteConfig, Router, ROUTER_DIRECTIVES} from 'angular2/router';
import {FORM_PROVIDERS} from 'angular2/common';
import {RouterActive} from './directives/router-active';
// import {Home} from './home/home';
import { InfiniteScroll } from 'angular2-infinite-scroll';
import { YoutubeVideos } from './youtube-videos/youtube-videos';
import { YoutubeSearch } from './core/services/youtube.search';
/*
* App Component
* Top Level Component
*/
@Component({
selector: 'app',
providers: [...FORM_PROVIDERS, YoutubeSearch],
directives: [...ROUTER_DIRECTIVES, RouterActive, InfiniteScroll],
pipes: [],
styles: [],
template: require('./app.html')
// <li router-active="active">
// <a [routerLink]=" ['Index'] ">Index</a>
// </li>
// <li router-active="active">
// <a [routerLink]=" ['Home'] ">Home</a>
// </li>
// </ul>
// </nav>
// </header>
})
@RouteConfig([
{ path: '/', component: YoutubeVideos, name: 'Index' },
// { path: '/home', component: Home, name: 'Home' },
{ path: '/**', redirectTo: ['Index'] }
])
export class App {
public start = true;
constructor(public youtubeSearch: YoutubeSearch) {
}
onScroll () {
if (this.start) {
this.start = false;
return;
}
this.youtubeSearch.searchMore();
}
}