JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyController as ctrl">
<select ng-model="ctrl.selectedElement" ng-options="element.description for element in ctrl.elements track by element.id"></select>
<button ng-click="ctrl.isFirst()">=== ctrl.elements[0]?</button>
</div>
JavaScript
var MyElement = function (id, description) {
this.id = id;
this.description = description;
}
var MyController = function () {
this.elements = [
new MyElement(1, 'First'),
new MyElement(2, 'Second')
];
//this.selectedElement = this.elements[0];
};
MyController.prototype.isFirst = function (element) {
console.log(this.selectedElement === this.elements[0] ? 'YES!' : 'NO!');
console.log(this.selectedElement);
console.log(this.elements[0]);
};
angular
.module('myApp', [])
.controller('MyController', MyController);