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']); })(); 
  • try $location.path() == '/' . And even better - just look. what $ location.path () returns to you on the main page - Grundy
  • if you use $ location.path () == '/', then the necessary block is not displayed anywhere. - webEugene
  • angular newbie, how to check what $ location.path () returns? - webEugene
  • how to check what $ location.path () returns - for example, display in view: {{$location.path()}} - Grundy
  • {{$ location.path ()}} - does not output anything :( tried {{1 + 1}} gives 2. - webEugene

0