<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="">
<select name="singleSelect" id="singleSelect" ng-model="data.singleSelect">
<option value="">---Please select---</option> <!-- not selected / blank option -->
<option value="1">January</option> <!-- interpolation -->
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
</select><br>
<br><br>You selected {{data.singleSelect}}
<p>Amount:
<input type="text" ng-model="a" />
</p>
<p>Sum: ${{ a / data.singleSelect * 12}}</p>
</div>
</body>
</html>
====
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body ng-app="myApp">
<div ng-controller="myCtrl">
<p>Write something in the input field:</p>
<input type="text" ng-change="myFunc()" ng-model="myValue" value="23" />
<p>The input field has changed {{count}} times.</p>
</div>
<script>
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
$scope.count = 0;
$scope.myValue= '$';
$scope.myFunc = function() {
$scope.count++;
$scope.myValue = '$' + $scope.myValue.replace("$", "");
};
}]);
</script>
</body>
</html>
No comments:
Post a Comment