Problem with select element


#1

Hi, I want to use to do two thing.
One is clear select value, other one is get the change value.

HTML

<select ng-model="val" ng-options="answer for answer in ListAnswer" ng-change="ChangeValue()">
</select>
<button ng-click="ClearData()">clear</button>

controller

 $scope.ListAnswer = ['Reggae', 'Chill','Dubstep','Indie','Rap','Cowbell'];

  $scope.ClearData = function(){
    delete $scope.val;
  };

  $scope.ChangeValue = function(){
    console.log($scope.val);
  };

I sure that can work on pure angular, but ionic can’t!


#2

If it is working with Angular then it should be working with Ionic. Are you sure problem is no with something else??


#3

I hope it is my mistake.
I created a new project, that I try to see this problem, but I also have this problem!

BTW, I run it at compute browser, it should be the same on device.


#4

Can you throw this in to a codepen? I believe the issue is the syntax, which is only available in 1.3.


#5

beta 13


#6

Alright, you may want to switch to this format.

The way you had it set up isn’t available in the version of angular that is bundled with beta 13.
Beta 14 has version 1.3 of angular, which does support ng-options.


#7

I try to use your example, that also can’t solved my problem.
I think this issue is from ionic, that can work on angular.

Maybe I should use other way to do it!