0

How to redirect the user on change of the selection?

html code

<select name="annee" ng-model="annee" ng-change="selectAnnee()"> 
    <option value="2000" ng-selected="2000==2014">2012</option>
    <option value="2001" ng-selected="2001==2014">2013</option>
    <option value="2002" ng-selected="2002==2014">2014</option>
</select>

js code

this.selectAnnee = function(){
window.location.href=link.substring(link.indexOf('/'),link.lastIndexO‌​f('/')) + '/fiche?type=' + this.type + '&annee=' + $scope.annee;
}

Thanks in advance!

user3821280
  • 39
  • 1
  • 7

1 Answers1

0

In your controller , do this

$scope.selectAnnee = function(){
     $location.path("/REDIRECT_HERE");
}

In view

<select name="annee" ng-model="annee" ng-change="selectAnnee()"> 
    <option value="2000" >2012</option>
    <option value="2001" >2013</option>
    <option value="2002" >2014</option>
</select>
vimal1083
  • 8,499
  • 6
  • 34
  • 50
  • I'm currently using this `this.selectAnnee = function(){window.location.href=link.substring(link.indexOf('/'),link.lastIndexOf('/')) + '/fiche?type=' + this.type + '&annee=' + $scope.annee;}` and it is not working. – user3821280 Jul 18 '14 at 09:20
  • @user3821280 check your console, there you might find any error log – vimal1083 Jul 18 '14 at 09:22