I think that you have incorrectly identified the problem: your external ng-repeatmeans that you have three separate blocks of choice that are trying to use the same one ng-model. (Note that he You selected: {{selectedCar}}never sees any of the values.) Here I changed this ng-model to an array, so that each of the values can be tracked separately; the entire set can be cleared by simply emptying the array.
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.selectedCar = [];
$scope.cars = [{
model: "Ford Mustang",
color: "red"
},
{
model: "Fiat 500",
color: "white"
},
{
model: "Volvo XC90",
color: "black"
}
];
$scope.cl = function() {
$scope.selectedCar = []
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<p>Select a car:</p>
<div ng-repeat="y in cars">
<select ng-model="selectedCar[$index]">
<option ng-repeat="x in cars" value="{{x.model}}">{{x.model}}</option>
</select>
<span ng-if="!selectedCar[$index]">Choose a car</span>
</div>
<h1>You selected: {{selectedCar}}</h1>
<button ng-click="cl()">click</button>
</div>
Run codeHide result