2014-07-15 18 views
0

這是我的角度js代碼。Angularjs傳達&到&

$scope.getEventSeconds = function(){ 
    $http.get('myfile.php', { 
    params: { 
     'action': 'get_datas' 
    } 
}).success(function(data){ 
     $scope.list = data; 
     $scope.currentPage = 1; //current page 
     $scope.entryLimit = 10; //max no of items to display in a page 
     $scope.filteredItems = $scope.list.length; //Initially for no filter 
     $scope.totalItems = $scope.list.length; 
    }); 
} 

這是工作找到返回的所有數據,但其轉換網址&到&喜歡。

http://example.com?id=1&name=myname這是網址存儲到數據庫。

它將url轉換爲。

http://example.com?id=1&name=myname它顯示像。

請大家幫忙。

謝謝。

+0

這兩個示例url/ –

+0

有什麼不同現在檢查我編輯我的問題謝謝。 –

+0

它仍然不清楚你的url變量是什麼... –

回答

0

我不知道究竟從那裏您的網址是未來,但我想你可以做這樣的事情:

var url = 'http://example.com?id=1&name=myname' 
url = url.replace(/&/g, "&") 

我希望如果不是感謝給更多信息,這可以幫助你。

0

我猜你所有的網址都存儲在ajax響應中返回的'數據'中。並且你有存儲在數據庫中的URL並被轉義。您可以通過消除它們來恢復網址。

$scope.list = data.replace(/&/g, "&"); 

然而,這是危險的,只有當你顯示網址時才應該做爲過濾器。