Skip to content

Instantly share code, notes, and snippets.

@gangadharjannu
Created October 31, 2014 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gangadharjannu/0cbc01c2a214adff20aa to your computer and use it in GitHub Desktop.
Save gangadharjannu/0cbc01c2a214adff20aa to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-controller="myCtrl">
<select ng-model="myOptions" ng-change="logThis()" ng-init="myOptions=items[0].name">
<option value="All">select this</option>
<option ng-repeat="item in items" value="{{item.age}}">{{item.name}}</option>
</select>
<button ng-click="bClick()">click me</button>
<script id="jsbin-javascript">
var app=angular.module('myApp',[]);
app.controller('myCtrl', function($scope){
$scope.items = [{name: 'one', age: 30 },{ name: 'two', age: 27 },{ name: 'three', age: 50 }];
$scope.logThis=function(){
console.log($scope.myOptions);
};
$scope.bClick=function(){
alert($scope.myOptions);
};
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"><\/script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-controller="myCtrl">
<select ng-model="myOptions" ng-change="logThis()" ng-init="myOptions=items[0].name">
<option value="All">select this</option>
<option ng-repeat="item in items" value="{{item.age}}">{{item.name}}</option>
</select>
<button ng-click="bClick()">click me</button>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">var app=angular.module('myApp',[]);
app.controller('myCtrl', function($scope){
$scope.items = [{name: 'one', age: 30 },{ name: 'two', age: 27 },{ name: 'three', age: 50 }];
$scope.logThis=function(){
console.log($scope.myOptions);
};
$scope.bClick=function(){
alert($scope.myOptions);
};
});</script></body>
</html>
var app=angular.module('myApp',[]);
app.controller('myCtrl', function($scope){
$scope.items = [{name: 'one', age: 30 },{ name: 'two', age: 27 },{ name: 'three', age: 50 }];
$scope.logThis=function(){
console.log($scope.myOptions);
};
$scope.bClick=function(){
alert($scope.myOptions);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment