JavaScript Getting part of a URL path via Angular.js

I want to get part of a path in URL via Angular.js and i found solution: http://mywebsite.com/one/HEREiWANT/three

first i do this:

app.config(function($locationProvider){
    $locationProvider.html5Mode(true);
});

then i define my controller like this:

app.controller("mainCtrl", function ($scope,$location) {
//...
}

then with this method i can get what i want and it works!:

$scope.getURLPart = function () {
    return pId = $location.path().split("/")[3]||"Unknown";
};

But this has a huge problem, right now after this changes, all of my linkes in my website doesn't work. When i click on a link, address in browsers address bar changes but i stay at the same page and redirection process doesn't happen. Why? How i can achieve what i want without with this problem?

Answer:1

I am using mssql with node.js to connect to an sql server db. I am trying to reduce code by wrapping the connection code in a function with one query parameter. When I call the function from with in a ...

I am using mssql with node.js to connect to an sql server db. I am trying to reduce code by wrapping the connection code in a function with one query parameter. When I call the function from with in a ...

  1. node mysql function
  2. sql server nodes function
  3. node js mysql query function
  4. node js call mysql function
  5. node mysql query function
  6. node js mysql function
  7. node js sync function mysql
  8. node-red function mysql

How can I make each of them to fadeInUp but in sequence? demo http://jsfiddle.net/uz2rm8jy/4/ HTML <div class="c one"></div> <div class="c two"></div> <div class="c ...

How can I make each of them to fadeInUp but in sequence? demo http://jsfiddle.net/uz2rm8jy/4/ HTML <div class="c one"></div> <div class="c two"></div> <div class="c ...

  1. sequential animation with css
  2. sequential animation in android example
  3. sequential animation in qml
  4. sequential animation in powerpoint
  5. sequential animation in android

I am trying to scrape https://www.freelance.nl/opdrachten/zoeken for data using Request and Cheerio but I am running into issues posting search terms. I cannot see where the search string and ...

I am trying to scrape https://www.freelance.nl/opdrachten/zoeken for data using Request and Cheerio but I am running into issues posting search terms. I cannot see where the search string and ...

  1. find form 990
  2. find form adv
  3. find form 5500
  4. find form
  5. find form jquery
  6. find form of verb
  7. find form number mjpru
  8. find form 16 online
  9. find form number ccsu
  10. find form ltd
  11. find form 26as online
  12. find form 1040
  13. find form by name jquery
  14. find form element by name jquery
  15. find form 16
  16. find form element jquery
  17. find form input by name jquery
  18. find form 1095 a
  19. find form no. mjpru
  20. find form mjpru

I know you can do ternary expressions in Javascript for an if - else statement, but how about an else- else if- else statement? I thought that surely this would be supported but I haven't been able to ...

I know you can do ternary expressions in Javascript for an if - else statement, but how about an else- else if- else statement? I thought that surely this would be supported but I haven't been able to ...