This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as angular from 'angular'; | |
| import ngRedux from 'ng-redux'; | |
| import {store} from "../../app/redux"; | |
| angular.module('config.redux', [ngRedux]) | |
| .config(['$ngReduxProvider', $ngReduxProvider => { | |
| $ngReduxProvider.provideStore(store); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {NgModule} from '@angular/core'; | |
| import {AppComponent} from './app.component'; | |
| import {NgRedux, NgReduxModule} from '@angular-redux/store'; | |
| import {store} from "./redux"; | |
| import {IAppState} from "./redux/interfaces/state"; | |
| @NgModule({ | |
| declarations: [ | |
| AppComponent | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const ADD_LANGUAGE = 'ADD_LANGUAGE'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {combineReducers} from "redux"; | |
| import {language} from "./languages"; | |
| export const rootReducer = combineReducers({ | |
| languages | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {ADD_LANGUAGE} from "../actions"; | |
| import {INITIAL_STATE} from "./initial-state"; | |
| import {ILanguage} from "../interfaces/languages"; | |
| export function languages(state = INITIAL_STATE.languages, action):ILanguage[] { | |
| switch (action.type) { | |
| case ADD_LANGUAGE: | |
| return state.concat(Object.assign({}, action.language)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {createStore} from 'redux'; | |
| import {rootReducer} from "./reducers"; | |
| import {INITIAL_STATE} from "./reducers/initial-state"; | |
| export const store = createStore(rootReducer, INITIAL_STATE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {IAppState} from "../interfaces/state"; | |
| export const INITIAL_STATE: IAppState = { | |
| languages: [] | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {ILanguage} from "./languages"; | |
| export interface IAppState { | |
| languages: ILanguage[]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as angular from 'angular'; | |
| import ngRedux from 'ng-redux'; | |
| import {ADD_LANGUAGE} from "../../../app/redux/actions"; | |
| angular.module("any.module", [ngRedux]) | |
| .run(['$ngRedux', $ngRedux => { | |
| let language = { | |
| shortcode: 'en', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Component, OnInit} from '@angular/core'; | |
| import {NgRedux, select} from "@angular-redux/store"; | |
| import {IAppState} from "./path/to/state"; | |
| @Component({ | |
| selector: 'app-any', | |
| templateUrl: './any.component.html', | |
| styleUrls: ['./any.component.scss'] | |
| }) | |
| export class AnyComponent implements OnInit { |
OlderNewer