I have a "select" using ng-options. It has 4 "periods". After an event is triggered, this happens:
if ($scope.periods.length <= 4) {
$scope.periods.push({
IdPeriod: 6,
Description: "PERSONALIZADA"
});
}
setTimeout(() => {
sel.options[sel.options.length - 1].selected = true;
}, 100);
I'm creating a new option, that shouldn't be showed from start. After it, with a short timeout (sel.options[5]
seems undefined inmediatly after creating it), I'm selecting it to be showed in the "select".
The thing is that, if I trigger the event that creates that option, and re-select the option that was selected before creating the new one, it won't call the method assigned to ng-change.