I hit my head against the wall, trying to understand why angularJS routing does not work on the phone for me. I have all the files installed correctly, and I am not getting any errors. I am trying to change the url using the $ location.url service directly from angular. Therefore, when you click on a div, the controller will have $ location.url ("profile") and nothing will happen. I tried the solution found in this https://stackoverflow.com/a/166269/2126 , but this does not work for me. Am I doing something wrong, or is there a better way to approach this? Below is the routing I set
var app = angular.module("App", ["hmTouchevents"]) .config(function($routeProvider) { $routeProvider .when("/index.html", { templateUrl: "/views/login.html", controller: "loginCtlr" }) .when("/landing", { templateUrl: "/views/landing.html", controller: "landingCtlr" }) .when("/single-view/:id", { templateUrl: "/views/single-view.html", controller: "singleViewCtlr" }) .when("/restaurant", { templateUrl: "/views/restaurant-info.html", controller: "restaurantCtlr" }) .when("/profile/:id", { templateUrl: "/views/profile.html", controller: "profileCtlr" }) .when("/lists/:list", { templateUrl: "/views/lists.html", controller: "listsCtlr" }) .when("/follow/:type", { templateUrl: "/views/follow.html", controller: "followCtlr" }); });
Sampling Controller:
app.controller("listsCtlr", ["$scope", "$location", function($scope, $location){ $scope.goTo("profile"); }]);
As always, any help is greatly appreciated.
source share