Socket
Socket
Sign inDemoInstall

angular-viewstate

Package Overview
Dependencies
17
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-viewstate

A state machine suited for angular 1.x digest


Version published
Maintainers
1
Install size
111 kB
Created

Readme

Source

#angular-viewstate

A state machine suited for angular 1.x digest

Installation

Requires browserify or similar npm-based build system.

In the command line:

npm install angular-viewstate --save

In your angular composition:

angular.module('myModule', [])
  .factory('viewState', require('angular-viewstate');

Usage

function controller($scope) {

  // setup states
  var state = require('angular-viewstate)
    .state('LOADING')
    .state('READY')
    .state('SAVING')
    .flag('isLoading').expression('LOADING')
    .flag('isReady').expression('!LOADING').delay(10)
    .flag('isIdle').expression('READY')
    .finalise($scope);
    
  // change state
  state.go.LOADING()
  loadSomething()
    .then(...)
    .finally(state.go.READY);
}

Every state() that is defined will produce a method on the go object.

Every flag expression() is an angular $watch expression where any identifier is replaced by (viewState === "<identifier>"). When finalise() is called the watchers are installed on the given scope.

Keywords

FAQs

Last updated on 18 May 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc