🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

cerebral-angular-immutable-store

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral-angular-immutable-store

A Cerebral package for angular and immutable store

Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
5
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

cerebral-angular-immutable-store

A cerebral package for angular and immutable-store

Debugger

You can download the Chrome debugger here.

More info on Cerebral and video introduction

Cerebral main repo is located here and a video demonstration can be bound here.

Install

npm install cerebral-angular-immutable-store or bower install cerebral-angular-immutable-store

Get started

angular.module('app', ['cerebral'])
  .config(function (cerebralProvider) {

    // Sets the initial state of the app
    cerebralProvider.setState({
      list: ['foo']
    });

    // Sets default arguments passed to all signals
    cerebralProvider.setDefaultArgs({
      foo: 'bar'
    });

  })
  .directive ('myComponent', function () {
    return {
      controllerAs: 'myComponent',
      scope: {},
      templateUrl: 'myComponent.html',
      controller: function ($scope, cerebral) {

        // Adds a "list" prop to the $scope which
        // will automatically update when the list
        // updates
        cerebral.injectState($scope, {
          list: ['list']
        });

        // Trigger signals
        $scope.addItem = function () {
          cerebral.signals.addItemClicked();
        };

      }
    };
  })
  .run(function (cerebral) {

    // Create actions
    var addItem =  function addItem (args, state) {
      state.push('list', 'bar');
    };

    // Create signals
    cerebral.signal('addItemClicked', addItem);

  });

Try it out

  • Clone repo
  • npm install
  • npm start
  • Go to localhost:8080

Keywords

angular

FAQs

Package last updated on 23 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts