Test ng-change on select in Angular

by Nelu Malancea

HTML

<div ng-app="app" ng-controller="ctrl">
    {{current}}
    
    <select ng-model="current" ng-options="o.val for o in greetings"></select>
</div>

JavaScript

angular.module("app",[]).controller("ctrl",function($scope){
    $scope.greetings = [
        {id: 1, val: "hello"},
        {id: 4, val: "hola"},
        {id: 5, val: "hey you"},
    ];
        
    $scope.current = $scope.greetings[0];
});