Skip to content

Commit f63e834

Browse files
Pietro GrandiPietro Grandi
authored andcommitted
formatted
1 parent c7017ec commit f63e834

File tree

6 files changed

+37
-30
lines changed

6 files changed

+37
-30
lines changed

app/app.component.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {Component, OnInit} from '@angular/core';
2-
import {Store, provideStore} from "@ngrx/store";
3-
import {Observable} from "rxjs/Rx";
4-
import {CurrentSearch} from "./models/current-search.model";
5-
import {ProximitySelector} from "./components/proximity-selector.component";
6-
import {SearchBox} from "./components/search-box.component";
7-
import {SearchReducer} from "./reducers/search.reducer";
2+
import {Store, provideStore} from '@ngrx/store';
3+
import {Observable} from 'rxjs/Rx';
4+
import {CurrentSearch} from './models/current-search.model';
5+
import {ProximitySelector} from './components/proximity-selector.component';
6+
import {SearchBox} from './components/search-box.component';
7+
import {SearchReducer} from './reducers/search.reducer';
88

99
const storeManager = provideStore({ currentSearch: SearchReducer });
1010

@@ -13,18 +13,26 @@ const storeManager = provideStore({ currentSearch: SearchReducer });
1313
providers: [ storeManager ],
1414
directives: [ SearchBox, ProximitySelector ],
1515
template: `
16-
<h1>{{title}}</h1>
17-
<div class="row">
18-
<search-box [store]="store"></search-box>
19-
<proximity-selector [store]="store"></proximity-selector>
20-
</div>
21-
<p>{{ state | json }}</p>
16+
<section class="col-md-8">
17+
<h1>{{title}}</h1>
18+
<div class="row col-md-8">
19+
<search-box [store]="store"></search-box>
20+
<proximity-selector [store]="store"></proximity-selector>
21+
</div>
22+
<div class="row col-md-8">
23+
<p>
24+
Try to type something in the searchbox, play with the location and with radius: the above state will
25+
always be consistent and up to date.
26+
</p>
27+
<p>{{ state | json }}</p>
28+
</div>
29+
</section>
2230
`
2331
})
2432

2533
export class AppComponent implements OnInit {
2634

27-
title = 'heroes and books'; //One Source of Truth for Angular 2';
35+
title = 'One Source of Truth for Angular 2';
2836

2937
private state: CurrentSearch;
3038

app/components/proximity-selector.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {Component, Input} from "@angular/core";
2-
import {Store} from "@ngrx/store";
3-
import {CurrentSearch} from "../models/current-search.model";
1+
import {Component, Input} from '@angular/core';
2+
import {Store} from '@ngrx/store';
3+
import {CurrentSearch} from '../models/current-search.model';
44

55
@Component({
66
selector: 'proximity-selector',

app/components/search-box.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {Observable} from "rxjs/Rx";
2-
import {ElementRef, OnInit, Component, Input} from "@angular/core";
3-
import {Store} from "@ngrx/store";
1+
import {Observable} from 'rxjs/Rx';
2+
import {ElementRef, OnInit, Component, Input} from '@angular/core';
3+
import {Store} from '@ngrx/store';
44

55
@Component({
66
inputs: ['store'],

app/main.ts

100644100755
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { provide } from '@angular/core';
21
import { bootstrap } from '@angular/platform-browser-dynamic';
32
import { HTTP_PROVIDERS } from '@angular/http';
43

app/reducers/search.reducer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ActionReducer, Action } from '@ngrx/store';
2-
import {CurrentSearch} from "../models/current-search.model";
3-
import {SearchBox} from "../components/search-box.component";
4-
import {ProximitySelector} from "../components/proximity-selector.component";
2+
import {CurrentSearch} from '../models/current-search.model';
3+
import {SearchBox} from '../components/search-box.component';
4+
import {ProximitySelector} from '../components/proximity-selector.component';
55

66
export const SearchReducer: ActionReducer<CurrentSearch> = (state: CurrentSearch, action: Action) => {
77
switch (action.type) {

app/services/youtube.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {BehaviorSubject, Observable} from "rxjs/Rx";
2-
import {Injectable} from "@angular/core";
3-
import {Response, Http} from "@angular/http";
4-
import {SearchResult} from "../models/search-result.model";
5-
import {SearchQuery} from "../models/search-query.model";
1+
import {BehaviorSubject, Observable} from 'rxjs/Rx';
2+
import {Injectable} from '@angular/core';
3+
import {Response, Http} from '@angular/http';
4+
import {SearchResult} from '../models/search-result.model';
5+
import {SearchQuery} from '../models/search-query.model';
66

7-
const YOUTUBE_API_KEY = "AIzaSyDOfT_BO81aEZScosfTYMruJobmpjqNeEk";
8-
const YOUTUBE_API_URL = "https://www.googleapis.com/youtube/v3/search";
7+
const YOUTUBE_API_KEY = 'AIzaSyDOfT_BO81aEZScosfTYMruJobmpjqNeEk';
8+
const YOUTUBE_API_URL = 'https://www.googleapis.com/youtube/v3/search';
99
const LOCATION_TEMPLATE = 'location={latitude},{longitude}&locationRadius={radius}km';
1010

1111

0 commit comments

Comments
 (0)