mehrdad mehrdad - 4 months ago 26
AngularJS Question

use persian character in query string with angularjs

in query string have persian character but url like this :

localhost:53297/#/Item/News/1-1-1-3?title=%D8%B1%D9%88%D9%86%D9%85%D8%A7%DB%8C%DB%8C%20%D8%A7%D8%B2%20%D8%AA%D8%A8%D9%84%D8%AA%20%D9%87%D8%A7%DB%8C%20%D8%B4%D8%B1%DA%A9%D8%AA%20HP


I want url like this:

localhost:53297/#/Item/News/1-1-1-3?title=طلا-نقره

Answer

try using decodeURIComponent(yourUrl)

and globally you can use something like this

$rootScope.$on('$locationChangeStart', function (e, newUrl, oldUrl) {
    $location.$$absUrl = decodeURIComponent(newUrl);
});