Simple State Illustration

Baobab version

This example illustrates the idea of having your whole state on one place using Baobab library, described in the post A more functional approach to Angular, with Baobab.

Here's the link to source code.

In this application the state is represented by a map, with two properties: foos and bars. Both are arrays of string.

One '.run' module listens to all changes in the state, and stores it in local storage. Every time you come back to this page, the state is going to be loaded back from local storage.


"Foo" form

By clicking "Add Foo", one adds a string to the foos array.

New Foo:


First "Bar" form

To be able to add a string to bars, add the string 'requiredFoo' to foos.

New Bar:


Second "Bar" form

Another form using the same bar controller.

New Bar:

Click here to undo.

Click here to clear the State.


Read Only Controller

Foos:

Bars: