JSFiddle - React, Tailwind, and code Playground

by Mahbubur Rahman

HTML

<div ng-controller="MyCtrl">
  <select ng-model="selectedOption" ng-change="handleSelection()">                        
    <option value="A" >A</option>
    <option value="B">B</option>
    <option value="C">C</option>
    <option value="D">D</option>
</select>

</div>

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.selectedOption = "A";
    $scope.lastSelectedOption = "A";
    $scope.handleSelection = function(){
    
    console.log("Selected Item: "+$scope.selectedOption);
    console.log("Last Selected Item:" + $scope.lastSelectedOption);
    console.log("");
    $scope.lastSelectedOption = $scope.selectedOption;
    }
}