javascript - how to stop ui-sref encoding url params -
here link i'm using ui-sref
attribute directive:
<a ui-ref="show.hastitle({uuid:item.uuid, title:item.title})">
title parameter can persian word, , expect such link below:
http://domain.com/page/54c82de2978af/واژه-فارسی
but ui-sref
returns below:
http://domain.com/page/54c82de2978af/%d9%88%d8%a7%da%98%d9%87-%d9%81%d8%a7%d8%b1%d8%b3%db%8c
i've used such solutions below:
var noneencodeduri = { encode: function(str) { return str && str.replace(/ /g, "-"); }, decode: function(str) { return str && str.replace(/-/g, " "); }, is: angular.isstring, pattern: /[^/]+/ }; $urlmatcherfactoryprovider.type('noneencodeduri', noneencodeduri); $stateprovider.state('mystate', { url: "/{title:noneencodeduri}" })
but rendered link didn't change how can stop ui-sref
encoding url params completely?
i've used scope function solve issue:
$scope.beautyuri = function (uuid, title) { return decodeuricomponent($state.href("show.hastitle", {uuid: uuid, title: title})); };
and use function in html this:
<a href="{{beautyuri(item.uuid, item.title)}}">{{title}}</a>
Comments
Post a Comment