-2
我想使用AngularJS讀取URL查詢參數的值。我訪問HTML與以下網址:如何在角度解析默認查詢參數
http://demo.com/demo/demo.html?param1=125¶m=4
控制器:
App.controller('DrawsController', ['$scope','$q','$location','$http', function($scope,$q,$location,$http){
\t var deferred = $q.defer();
\t $http({
\t \t url: "./api/api.php",
\t \t method: "get",
\t \t dataType: "json",
\t \t params: {
\t \t \t param1: $location.param1,
\t \t \t param: $location.param
\t \t }
\t })
\t .success(function (data, status, headers, config) {
\t })
\t .error(function (data, status, headers, config) {
\t });
\t deferred.promise;
}]);
@neelsg我想使用的角度,從給定的URL參數爲第三方API請求。 – Vishal 2014-10-31 09:57:26