tafax / angular-state-machine Goto Github PK
View Code? Open in Web Editor NEWAngularJS service to implement a finite state machine.
License: MIT License
AngularJS service to implement a finite state machine.
License: MIT License
Thanks for making this available. Would you have an example of what the JSON config should look like? Or any samples at all... Thanks again!!
We need to add the ability to use promise as action response. We want the state machine can change state invoking send in the nested way or in the sequential one.
Nested invoke
stateMachine.send('message').then(function() {
stateMachine.send('another message').then(function() {
....
});
});
Sequential invoke
stateMachine.send('message').then(function() {
....
});
stateMachine.send('another message').then(function() {
....
});
The two strategies should produce the same result.
Hi, I'm trying to use your code to make a configuration state machine, but doesn't work..
When I call the method "setConfig" from stateMachineProvider, is it make this error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module BssJS due to:
TypeError: stateMachineProvider.setConfig is not a function
at file:///C:/Desenvolvimento/workspace/BSSJs/scripts/app.js:4:24
at Object.invoke (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:4478:17)
at runInvokeQueue (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:4384:35)
at file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:4393:11
at forEach (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:336:20)
at loadModules (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:4374:5)
at createInjector (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:4299:11)
at doBootstrap (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:1657:20)
at bootstrap (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:1678:12)
at angularInit (file:///C:/Desenvolvimento/workspace/BSSJs/libs/angular.js:1572:5)
http://errors.angularjs.org/1.4.7/$injector/modulerr?p0=BssJS&p1=TypeError%…FC%3A%2FDesenvolvimento%2Fworkspace%2FBSSJs%2Flibs%2Fangular.js%3A1572%3A5)
Using his example the same error occurs..
Here is my code:
angular.module('BssJS', ['FSM']);
angular.module('BssJS').config(function(stateMachineProvider){
console.log(stateMachineProvider);
stateMachineProvider.setConfig({});
});
In javascript console, the object stateMachineProvider do not have the setConfig method. Can you help-me ?
Sorry for my english, I'm not good :(
This looks like some neat code. I'm wanting to use an FSM to handle conditional UI. It's for a filter interface in which I only want to allow the filter button to be clicked when one of the filter parameters changes and when all of the filter parameters are valid. It's actually quite a complex little task.
This project looks like it might help. Although, from what I can gather this is to control an entire app? It's not suitable for just within a controller for example?
I just want to say that I find this library really useful and I was wondering if it's the case.
It helps me a lot on some personal projects :)
Keep the good work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.