Tuesday, April 15, 2014

A little trick to reloading an Angular.JS view using a hyperlink

Angular.JS routing can be tricky especially if you deal with hyperlinks.  Let's say you are currently on a view named '/contacts' and you have a hyperlink that points to '/contacts'.  The first thought is that clicking on this hyperlink would reload the view.  Instead nothing happens.  A little neat trick would be to add a forward slash to the URL like this '/contacts/'.  Doing this will force Angular to look at its route configuration and load the view.


No comments:

Post a Comment