Fix nullpointer when Connection refused
AngularJS - refactor views