Search code examples
javascriptangularjsangularjs-scopeangularjs-ng-options

redirect on ng-change in select tag


How do i pass the groupId in the below code

<select ng-options="group.id as group.name for group in groups" 
        ng-model="groupId" ng-controller="redirectCtrl" 
        ng-change="go('group/list/{{groupId}}')">

Solution

  • No need (or no point) to use interpolation in ng-change expression just use a valid expression to construct the argument to be passed in:

    Try:

     ng-change="go('group/list/' + groupId)"