How to use the @ngrx/store.provideStore function in @ngrx/store

To help you get started, we’ve selected a few @ngrx/store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teki-io / teki / client / src / client / main.ts View on Github external
import { bootstrap } from '@angular/platform-browser-dynamic';
import { ROUTER_PROVIDERS } from '@angular/router-deprecated';
import { APP_BASE_HREF } from '@angular/common';
import * as App from './app/shared/index';
import { AppComponent } from './app/components/index';
import { AuthConfig, AuthHttp } from 'angular2-jwt/angular2-jwt';
import { provideStore } from '@ngrx/store';
import { MODAL_BROWSER_PROVIDERS } from 'angular2-modal/platform-browser/index';

if ('<%= ENV %>' === 'prod') { enableProdMode(); }

bootstrap(AppComponent, [
  HTTP_PROVIDERS,
  ROUTER_PROVIDERS,
  MODAL_BROWSER_PROVIDERS,
  provideStore(App.APP_STORE),
  provide(APP_BASE_HREF, { useValue: '<%= APP_BASE %>' }),
  provide(AuthHttp, {
    useFactory: (http: Http) => {
      return new AuthHttp(new AuthConfig({
        noJwtError: true,
        tokenName: 'jwt'
      }), http);
    },
    deps: [Http]
  }),
  App.APP_PROVIDERS
]).catch(err => console.error(err));

// In order to start the Service Worker located at "./worker.js"
// uncomment this line. More about Service Workers here
// https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers
github benorama / ngrx-demo-apps / mobile / app / app.ts View on Github external
template: ''
})
export class MyApp {
  rootPage: any = HomePage;

  constructor(platform: Platform) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
    });
  }
}

ionicBootstrap(MyApp, [
  provideStore(reducers),
  //runEffects(effects),
  services,
  actions
]);
github brakmic / Angular-VR-Starter / src / app / stores / app / app.store.ts View on Github external
import { provideStore } from '@ngrx/store';
import { IAppState, IVrModule } from '../../interfaces';
import { LogService } from '../../services';
// Reducers
import { vrModuleReducer } from '../../reducers';

class AppStore implements IAppState {
  public vrModule: IVrModule;
  constructor(private logService: LogService) {
  }
}


// Define App-Store
const appStore = provideStore(
                  {
                    vrModule: vrModuleReducer
                  },
                  {
                    vrModule: this.vrModule
                  });

export {
  appStore
}
github ngrx / store-devtools / spec / store_spec.ts View on Github external
function createStore(reducer, monitorReducer = T => T){
    const injector = ReflectiveInjector.resolveAndCreate([
      provideStore(reducer),
      instrumentStore(monitorReducer)
    ]);

    const store = injector.get(Store);
    const devtools = injector.get(StoreDevtools);

    return { store, devtools };
  }
github infra-geo-ouverte / igo2 / src / app / store / store.module.ts View on Github external
export function provideIgoStore() {
  return provideStore({
    activeContext: activeContext,
    editedContext: editedContext,
    map: map,
    layers: layers,
    tools: tools,
    toolHistory: toolHistory,
    searchResults: searchResults,
    selectedResult: selectedResult,
    focusedResult: focusedResult
  });
}
github ngrx / example-app / src / main.browser.ts View on Github external
import services from './services';
import actions from './actions';
import guards from './guards';


bootstrap(App, [
  /**
   * provideStore is run once at application bootstrap, accepting a reducer
   * function or object map of reducer functions. If passed an object of
   * reducers, combineReducers will be run creating your application
   * meta-reducer. This returns all providers for an @ngrx/store
   * based application.
   *
   * Source: https://github.com/ngrx/store/blob/master/src/ng2.ts#L43-L69
   */
  provideStore(reducer),

  /**
   * runEffects configures all providers for @ngrx/effects. Observables decorated
   * as an @Effect() within the supplied services will ultimately be merged,
   * with output of relevant (registered as effects) actions being
   * dispatched into your application store. Any side-effects in
   * your application should be registered as effects.
   *
   * Source: https://github.com/ngrx/effects/blob/master/lib/run-effects.ts#L8-L20
   */
  runEffects(effects),

  /**
   * provideRouter sets up all of the providers for @angular/router. It accepts
   * an array of routes and a location strategy. By default, it will use
   * `PathLocationStrategy`.
github wpcfan / taskmgr / src / app / services / auth-guard.service.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [AuthGuardService, provideStore(Store)]
    });
  });
github r-park / soundcloud-ngrx / src / core / store.ts View on Github external
import { provideStore } from '@ngrx/store';
import { playerReducer, timesReducer } from './player';
import { searchReducer } from './search';
import { tracklistsReducer } from './tracklists';
import { tracksReducer } from './tracks';
import { usersReducer } from './users';


export const STORE_PROVIDERS = provideStore({
  player: playerReducer,
  search: searchReducer,
  times: timesReducer,
  tracklists: tracklistsReducer,
  tracks: tracksReducer,
  users: usersReducer
});
github FountainJS / generator-fountain-angular2 / generators / todoMVC / templates / src / app / components / MainSection.spec.js View on Github external
beforeEach(function () {
    ngTest.addProviders([ngrxStore.provideStore(ngrxStore.combineReducers({todos: reducers.todos, visibility: reducers.visibility}), {})]);
  });