I am trying to use the code below to extract the last segment in a URL, but it doesn't seem to work on the URL shown below. Can someone please check the code below and tell me what I am missing here? Thanks
var segment_str = window.location.pathname;
var segment_array = segment_str.split( '/' );
var last_segment = segment_array[segment_array.length - 1];
alert(last_segment);
URL
http://localhost/projects/myproject/app/#/sales/invoices/224
I need to extract only 224