2017-10-22 39 views
0

即時得到多個月在我這裏的網址我的問題,我得到的對象的,而不是我選擇angularjs如何把數組中的我的網址

enter image description here

,你可以看到幾個月的名字我網址我有對象個月=%5Bobject%20Object%5D

我希望看到這樣的月= [三月,四月]

這裏我在那個特定的組合框視圖

md-input-container flex="" 
     label Months 
     md-select ng-model="params.months[month]" multiple="true" 
     md-option ng-repeat="month in ctrl.months " ng-value="month" 
      | {{month}} 

這裏我控制器

#= require ./../../module 

class IncomeStatementIndexCtrl 
    constructor: ($scope, $route, $mdDialog, $filter, $routeParams, $location, Account, Branch)-> 
    @branches = Branch.query() 
    @clear = -> 
     $scope.params = {} 
     $location.search($scope.params) 

    $scope.params = $location.search() 

    @months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 
    'Sep', 'Oct', 'Nov', 'Dec'] 

    if $scope.params.as_of_date? 
    $scope.params.as_of_date = new Date($scope.params.as_of_date) 
    @incomes = Account::IncomeStatement.query ($scope.params), (data) => 


    @search =() => 
    $scope.params.date_to_compare = 
    $filter('date'($scope.params.date_to_compare , "yyyy-MM-dd") 
    $scope.params.as_of_date = $filter('date') 
    ($scope.params.as_of_date , "yyyy-MM-dd") 
    $location.search($scope.params) 



IncomeStatementIndexCtrl.$inject = ["$scope", "$route", "$mdDialog", "$filter", "$routeParams", "$location", "Account", "Branch"] 

angular 
    .module "CaesApp" 
    .controller "IncomeStatementIndexCtrl", IncomeStatementIndexCtrl 

我需要做到這一點,所以我可以糾正我的控制器的PARAMS在Ruby on Rails的

+0

發送params作爲數組,你需要在跨瀏覽器的方式做什麼..'?月= mar&month = apr&mon = may',你需要編寫自定義代碼或者使用一些庫來將數組轉換爲urlEncode格式' – harishr

回答

1

我不知道多少的角度,但對發送上的任何請求陣列爲:

request = url?parameter[]=a&parameter[]=b&parameter[]=c 

和在軌道上是

"parameter":[ 
"a","b","c" 
] 
+0

嗨@Darlyncinho布拉沃任何plunker或jsfiddle,所以我可以形象感謝回覆T_T – wiwit

相關問題