Skip to content

Commit c10a88a

Browse files
committed
working on Angular 2.0
1 parent 7fd61bb commit c10a88a

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {ProximitySelector} from "./components/proximity-selector.component";
1111
const storeManager = StoreModule.provideStore ({ currentSearch: SearchReducer });
1212

1313
@NgModule({
14-
imports: [ BrowserModule, StoreModule, storeManager, HttpModule ],
14+
imports: [ BrowserModule, StoreModule, storeManager, HttpModule ],
1515
declarations: [ AppComponent, SearchBox, ProximitySelector ],
1616
bootstrap: [ AppComponent ],
1717
providers: [ YouTubeService ]

app/components/proximity-selector.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ProximitySelector {
2626
radius: 'ProximitySelector:RADIUS',
2727
off: 'ProximitySelector:OFF'
2828
};
29-
29+
3030
@Input()
3131
store: Store<any>;
3232

@@ -67,4 +67,4 @@ export class ProximitySelector {
6767
});
6868
}
6969

70-
}
70+
}

app/components/search-box.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Store} from '@ngrx/store';
1010
})
1111

1212
export class SearchBox implements OnInit {
13-
13+
1414
static StoreEvents = {
1515
text: 'SearchBox:TEXT_CHANGED'
1616
};

app/reducers/search.reducer.ts

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

66
export const SearchReducer: ActionReducer<CurrentSearch> = (state: CurrentSearch, action: Action) => {
77
switch (action.type) {
8-
// case SearchBox.StoreEvents.text:
9-
// return Object.assign({}, state, {
10-
// name: action.payload.text
11-
// });
12-
// case ProximitySelector.StoreEvents.position:
13-
// return Object.assign({}, state, {
14-
// location: {
15-
// latitude: action.payload.position.latitude,
16-
// longitude: action.payload.position.longitude
17-
// }
18-
// });
19-
// case ProximitySelector.StoreEvents.radius:
20-
// return Object.assign({}, state, {
21-
// radius: action.payload.radius
22-
// });
23-
// case ProximitySelector.StoreEvents.off:
24-
// return Object.assign({}, state, {
25-
// location: null
26-
// });
8+
case SearchBox.StoreEvents.text:
9+
return Object.assign({}, state, {
10+
name: action.payload.text
11+
});
12+
case ProximitySelector.StoreEvents.position:
13+
return Object.assign({}, state, {
14+
location: {
15+
latitude: action.payload.position.latitude,
16+
longitude: action.payload.position.longitude
17+
}
18+
});
19+
case ProximitySelector.StoreEvents.radius:
20+
return Object.assign({}, state, {
21+
radius: action.payload.radius
22+
});
23+
case ProximitySelector.StoreEvents.off:
24+
return Object.assign({}, state, {
25+
location: null
26+
});
2727
default:
2828
return state;
2929
}

0 commit comments

Comments
 (0)