Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app='gobo' ng-controller='goboCtrl' >
        
        <h1 align='center'>
            {{value}}
            
    <select ng-model='value' >
        <option ng-repeat='(tid,groups) in templates' value='{{tid}}' on-last-repeat >{{tid}}         </option>
    </select>
          <button ng-click='refresh()' >Refresh</button>
</body>
</html>
 
var app=angular.module('gobo',[]);
//Create A Directive To Detect The End Of ng-repeat cycle.
        app.directive('onLastRepeat',function(){
            return function(scope,element,attrs) {
                if(scope.$last) { setTimeout(function(){
                    scope.$emit('onRepeatLast',element,attrs);
                    },10);
                        }
            };
        });
app.controller('goboCtrl',function($scope){
    $scope.value="2";
  $scope.$on('onRepeatLast', function(scope, element, attrs){
                        $scope.value='3';
    alert($scope.value);
                    });
  
  
  $scope.templates={};
  $scope.templates["1"]=[{"prop":"value1"}];
  $scope.templates["2"]=[{"prop":"value2"}];
   $scope.templates["3"]=[{"prop":"value3"}];
  
  $scope.refresh=function(){
    $scope.value="2";      
  };
});
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers