JSFiddle - React, Tailwind, and code Playground

by tadchristiansen

HTML

<div ng-app ng-controller="MyCtrl">
    <select ng-model="foo" ng-options="currOption for currOption in options" ng-change="myOnChange()"></select>
    <br>Selected: {{foo}}
</div>

JavaScript

function MyCtrl($scope)
{
    $scope.foo = "c";
    $scope.options = ["a", "b", "c", "d", "e", "f"];
    
    $scope.myOnChange = function() {
        //more logic here, but ends up back at c
        $scope.foo = "c";

/*      This is one possible workaround, but I don't want to do it for every change and I don't know if I can detect the one case I do need it for  
        $scope.foo = "a";
        setTimeout(function() {
            $scope.foo="c";
            $scope.$apply();
        }, 0);
*/
    }
}