Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ngrx-action-creator-factory with all npm packages installed. Try it out:

var ngrxActionCreatorFactory = require("ngrx-action-creator-factory")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ngrx-action-creator-factory v0.0.1

An Action Creator Factory for creating ngrx action creator

Ngrx Action Creator Factory

This is an angular 2 provider based - read about the concept at Simple Action Creators for ngrx/store in Angular 2.
This component came out as a result of the open source project Echoes Player - an alternative player for watching and listening to media from youtube.

Angular 2 Support

supports Angular 2 - Final - 2.2.1




npm install ngrx-action-creator-factory --save-dev

Supported API

Currently supported:

  • ActionCreatorFactory.create(action: string, payload?: any)


First, import the ActionCreatorFactory to your module:

import { NgModule } from '@angular/core';
import { ActionCreatorFactory } from 'ngrx-action-creator-factory';

  imports:[ BrowserModule ],
  providers: [ ActionCreatorFactory ],
  declarations: [ AppComponent, ],
  bootstrap: [ AppComponent ]
export class AppModule { }


Next, use the ngrx-action-creator-factory either as a static factory or as an injectable provider:

import { Injectable } from '@angular/core';
import { Action } from '@ngrx/store';
import { ActionCreatorFactory } from 'ngrx-action-creator-factory';

export class NowPlaylistActions {

  // as injectable
  constructor(private acf: ActionCreatorFactory) {
    this.queueVideo = this.acf.create(NowPlaylistActions.QUEUE);

  // as a static method
  mediaEnded = ActionCreatorFactory.create(NowPlaylistActions.MEDIA_ENDED);


To start developing tdd/bdd style: npm run dev This will: compile ts files, watch for changes and start the test task. Whenever a ts file is changed, it will rerun the tests.

Showcase Examples

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free