I have a select like this:
<select class="form-control" ng-hide="Catalogos.length==0" ng-change="filtro(selected)" ng-model="selected" ng-options="item.Nombre for item in Catalogos "></select>
From there I get selected value in function like this:
$scope.filtro = function(selected) {
$scope.selectedID = selected.ID;
}
There I get Id for selected value, but now I want to send this parameter to another function like:
$scope.insertar = function(selected) {
$scope.selectedID = selected.ID;
if ($scope.catalogoid != null) {...
But selected always come undefined
Note: $scope.insertar triggers when I clic submit button
<button type="submit" class="btn blue" ng-click="insertar();">Aceptar</button>
Help is very appreciated! Regards
<select>and<button>are in the same scope, you can just useng-click="insertar(selected)"