JSFiddle - React, Tailwind, and code Playground

by andhernand

HTML

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script>
<div ng-app="myApp">
    <div ng-controller="ctrl">
        <label for="select-this">Select this:</label>
        <select id="select-this" ng-model="selectedIndex" ng-change="updateSelection()">
            <option ng-repeat="weapon in selectOptions" value="{{ $index }}">{{ weapon }}</option>
        </select>
        <div>SelectedIndex: {{selectedIndex}}, SelectedWeapon: {{selected}}</div>
    </div>
    <br />
    <br />
    <div ng-controller="ctrlTwo">
        <label for="select-death">Select Death:</label>
        <select id="select-death" ng-model="selectedDeath" ng-options="death for death in deathOptions"></select>
        <div>Selected Death: {{ selectedDeath }}</div>
    </div>
</div>

JavaScript

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

    app.controller('ctrl', ['$scope', function ($scope) {
        $scope.selectOptions = ['Knife', 'Gun', 'Axe', 'Shoe'];
        $scope.selectedIndex = 0;
        $scope.updateSelection = function () {
            $scope.selected = $scope.selectOptions[$scope.selectedIndex];
        };
    }]);

    app.controller('ctrlTwo', ['$scope', function ($scope) {
        $scope.deathOptions = ['Throat Cancer', 'Dick Cancer', 'Ass Cancer'];
        $scope.selectedDeath = null;
    }]);
}(angular));