Book Image

AngularJS Web application development Cookbook

By : Matthew Frisbie
Book Image

AngularJS Web application development Cookbook

By: Matthew Frisbie

Overview of this book

Packed with easy-to-follow recipes, this practical guide will show you how to unleash the full might of the AngularJS framework. Skip straight to practical solutions and quick, functional answers to your problems without hand-holding or slogging through the basics. Avoid antipatterns and pitfalls, and squeeze the maximum amount out of the most powerful parts of the framework, from creating promise-driven applications to building an extensible event bus. Throughout, take advantage of a clear problem-solving approach that offers code samples and explanations of components you should be using in your production applications.
Table of Contents (17 chapters)
AngularJS Web Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing nested ui-router resolves


As you gain experience as an AngularJS developer, you will come to realize that the built-in router faculties are quite brittle in a number of ways—mainly that there can only be a single instance of ng-view for dynamic route templating. AngularUI provides a superb solution to this in ui-router, which allows nested states and views, named views, piecewise routing, and nested resolves.

How to do it…

The ui-router framework supports resolves for states in the same way that ngRoute does for routes. Suppose your application displayed individual widget pages that list the features each widget has, as well as individual pages for each widget's features.

State promise inheritance

Since nested states can be defined with relative state routing, you might encounter the scenario where the URL parameters are only available within the state in which they are defined. For this application, the child state has a need to use the widgetId and the featureId value in the child...