In his debut egghead.io lesson, Joel will show you how to get setup and running with ui-router, an alternative to AngularJS's default routing module.
Would #/list/Bread navigate straight to the bread section with the bread image already loaded (say this shopping list app was hosted online and from a fresh browser tab I enter listappname/list/Bread in the address bar).
Hey Ryan, it definitely should. Because "bread" is a parameter, the state should be contextually aware and load the appropriate state.
It's something that you have to consider in your controller and models. When you land in the state it should ask, "do I have the data? If yes, show, if no load".
One of the state config options is "resolve" that returns a promise to block the state from loading until the above is done, which can be useful for this type of logic.
Instead of using
ng-class to set the active view, try
That’s a great tip 👍