This repository was archived by the owner on May 4, 2022. It is now read-only.
This repository was archived by the owner on May 4, 2022. It is now read-only.
Problem setting certain item in select option from object collection. #103
Open
Description
From @yogi2806 on August 29, 2016 6:28
Short description of the problem:
I am facing 2 problems while using "select" in ionic which is working properly when i tried only using angularjs.
- Initially i am setting array of 1st index to select which is coming blank.
- I am trying to update array by splicing and trying to update select which is again bringing me blank select option.
What behavior are you expecting?
2 problems i am expecting respective array item to be selected which is given through controller.
Steps to reproduce:
- At start when u run the app we get blank select option.
- The other problem can be seen by deleting any item and other default item to be selected.
Code Snippet:
.controller('DashCtrl', function($scope) {
$scope.options = [{name: 'var1',id: 1}, { name: 'var2', id: 2}, {name: 'var3',id: 3}];
$scope.yourSelect = $scope.options[0];
$scope.delete = function() {
// alert("Clciked");
$scope.Deleted = $scope.options.splice(1,1);
$scope.yourSelect = $scope.options[0];
alert( $scope.yourSelect.name);
}
$scope.changed = function(yourSelect) {
alert( $scope.yourSelect.name);
}
})
For Ionic 1 issues - http://plnkr.co/edit/ZriDlmQL8VPRdk1NnDNa?p=preview
Run ionic info
from terminal/cmd prompt: (paste output below)
Cordova CLI: 6.0.0
Ionic Version: 1.3.1
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Windows 7 SP1
Node Version: v5.6.0
Copied from original issue: ionic-team/ionic-framework#7898