I have a dropdown list populated by one scope and the same list displayed using another scope. When I select something from the dropdown I want to hide/remove it from the display list, but keep the full list in the dropdown.
I have a JS fiddle started: https://jsfiddle.net/mfzbk8nv/6/
Fiddle: enter link description here
Right now what's happening is that it removed the first letter in the display list and not the one I want to remove. Second, it removes from both the dropdown and the displaylist.
Any help appreciated!
My HTML:
<div ng-app="myApp" ng-controller="myController">
<select ng-model="mySel" ng-options="i for i in list2" ng-change="removeIt(mySel)" ></select>
<ul style="list-style:none;">
<li ng-repeat="item in list1">
{{item}}
</li>
</ul>
</div>
My JS:
var app = angular.module('myApp', [])
app.controller('myController', function ($scope) {
$scope.data = {};
var arr = ['a', 'b', 'c', 'd', 'e']
$scope.list1 = arr;
$scope.list2 = arr;
$scope.removeIt = function(i){
$scope.list1.splice(i,1)
}
})