Created
October 31, 2014 14:36
-
-
Save gangadharjannu/0cbc01c2a214adff20aa to your computer and use it in GitHub Desktop.
// source http://jsbin.com/zuhulu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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