Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Assume the following route provider:

    myApp.config(['$routeProvider', function($routeProvider) {        

    $routeProvider.when('/multivalues/:value/:value/:value',
    {templateUrl: 'partials/multivalues.html',
    controller: 'MultiValueController'});
}]);

Ideally, we would like the variable $routeParams.value to contain a list of 3 elements. It seems that angularJS does not support this functionality.

What is the best practice to implement this functionality?

share|improve this question
3  
I'm afraid it can't contain 3 elements. You should use different var names: '/multivalues/:value1/:value2/:value3' –  jevgenig 21 hours ago
    
what you want to do? –  BlaShadow 21 hours ago
    
I would like to pass values in a route dynamically, i.e., "/multivalues/:value1/:value2/.../:value10" for passing 10 values. However, the number of different values might be less than ten. Of course, I do not want to write explicitly all the different routes from 1 to 10 ("/multivalues/:values1", "/multivalues/:values1/:values2", etc). –  Zouzias 21 hours ago
    
I don't know if this is possible, under what situation will you need to pass a varying number of params? –  Jared Reeves 21 hours ago
1  
Have you considered something like /:value then using $routeParams.value.split('&&')? –  Morgan Delaney 20 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.