!geek

Code, learn & share

Debugging angular ui-router

The ui-router from angular-ui gives power of nested states and multiple named views which is essential for angular apps with non-trivial layout and workflow.

The main problem with angular ui-router is getting the route configurations right in the first time. You start seeing blank pages for misconfigured views. The sad part is these errors are not logged to console. It gets quite frustrating in tracking down the cause.

Introducing f.js

Javascript code is quite verbose when compared to other langauges. One of the features I missed coming from the ruby world is lambdas and the &: sugar.

1
2
3
books.map { |book| => book.title }
# or even better
books.map(&:title)

compare this with javascript code

1
books.map(function(book) { return book.title })