I want to know what $ location.path () gives out and why Angular crashes because of it. What is wrong in the code ?. What could be the reason?
Thank you in advance!
(function() { angular.module('lostfound.common', []).controller('dateYear', function ($scope) { $scope.date = new Date(); }); angular.module('lostfound.pathlocation', []).controller('locationPath', function ($scope) { $scope.lpath = $location.path(); }); //ROUTING var logApp = angular.module('lostfound.routing', ["ngRoute"]).config(function($routeProvider) { $routeProvider .when("/", { templateUrl : "pages/home.html", }) .when("/about_us", { templateUrl : "pages/about_us.html", }) .when("/lost", { templateUrl : "pages/lost.html", }) .when("/found", { templateUrl : "pages/found.html", }) .when("/contact_us", { templateUrl : "pages/contact_us.html", }) .when("/register", { templateUrl : "pages/register.html", }) .when("/login", { templateUrl : "pages/popup/login.html", }) .otherwise({ redirectTo: "/" }); }); //gather modules angular.module('lostfound', ['lostfound.common','lostfound.pathlocation','lostfound.routing']); })();
$location.path() == '/'. And even better - just look. what $ location.path () returns to you on the main page - Grundy{{$location.path()}}- Grundy