[SalesForce] decode Special Character in Angular + Visualforce

My Object label is D & B Company, this is stored in a list at some place

When it comes to visualforce page in angular code, it is showing D&B Company

How can handle such type of special character in angular, I tried escape ="false"
but no result

function(result, event) {
                    $scope.Data =  result;
                    $scope.$apply();

                    angular.forEach($scope.Data, function(value, key){
                        if(value.objApiName == 'DatacloudDandBCompany')
                        {
                            var t = value.objLabel;

                        console.log("username is ::" + decodeURIComponent(t)); 
                        }
                    });

Best Answer

Use this for decode your url

your_url = decodeURIComponent(your_url);
your_url  = decodeURI(your_url );

Use this for encode url

your_url = encodeURIComponent(your_url);
your_url  = encodeURI(your_url );

It may be helpful for you.

Related Topic