Un menu a discesa contiene un valore di array. Se seleziono un valore dal menu a tendina rimuoverà il suo valore dal suo array. Ma al clic del pulsante di reset dovrebbe resettare con vecchi valori .Qui è il mio codiceDopo aver rimosso un elemento dalla matrice usando la giunzione. non resettando. Il mio codice ha qualche errore
codice HTML
<html>
<head>
<script src="angular/angular.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-app="myApp">
<div ng-controller="exerciseTypeCtrl">
<select id="exerciseSuperCategory" data-role="listview" ng-options="Lay.id as Lay.value for Lay in Layer " ng-model="itemsuper" ng-change="changeData(itemsuper)">
</select>
<input type="button" ng-click="resetLayer()" value="Reset"/>
</div>
</body>
</html>
angularjs codice controler
<script>
var myApp = angular.module('myApp',[]);
myApp.controller('exerciseTypeCtrl',function($scope)
{
$scope.Layer = [
{ id: 1, value: '0.38'},
{ id: 2, value: '0.76'},
{ id: 3, value: '1.14'},
{ id: 4, value: '1.52'},
{ id: 5, value: '1.9'},
{ id: 6, value: '2.28'},
{ id: 7, value: '2.66'},
{ id: 8, value: '3.04'},
{ id: 9, value: '3.42'},
{ id: 10, value:'3.8'},
{ id: 11, value: '4.18'},
{ id: 12, value: '4.56'}
];
$scope.changeData = function(value)
{
var coating = $scope.Layer;
if(coating != null)
{
var j = coating.length;
while(j>0)
{
j =j-1;
var make = coating[j]['id'];
var present = 0;
if(make == value)
{
coating.indexOf(make);
coating.splice(j,1);
}
}
}
}
$scope.resetLayer -function()
{
$scope.Layer = $scope.Layer;
}
});
</script>
utilizzando giunzione sto rimuovendo il valore selezionato discesa. ma il click del tasto la sua non è la reimpostazione
Grazie in anticipo
'-funzione $ scope.resetLayer()' -> '$ scope.resetLayer = function()' – briosheje