O'Reilly logo

AngularJS Services by Jim Lavin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling a view flow with a state machine

State machines represent a mathematical model of computational behavior. The model can be in any one of a number of finite states at any given time. The model changes from state to state when initiated by a triggering event or condition.

State machines are very good at handling complex user interface flow through an application. Each state can represent a view shown to the user. User interactions serve as the triggering events that can be used to transition from one state to another.

We can use a state machine to control the user's flow through our program, instead of coding the flow in our controllers. We can also use state machines to manage long-running processes between sessions.

The state machine ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required