Last active
August 29, 2015 14:15
-
-
Save jeshan/89e587705ae84578ea12 to your computer and use it in GitHub Desktop.
angular-intro-02; ng-bind and ng-model
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='angularApp'> | |
<head> | |
<meta name="description" content="angular-intro-02; ng-bind and ng-model"> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> | |
<script src="script.js"> | |
</script> | |
<meta charset="utf-8"> | |
</head> | |
<body ng-controller='HelloController'> | |
<p>Gross price: <input ng-model='price'/></p> | |
<p>Tax: <input ng-model='taxPercentage' /></p> | |
<p>Total price: <span ng-bind='price * (100 + taxPercentage) / 100'></span></p> | |
</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 module = angular.module('angularApp', [ ]); | |
module.controller('HelloController', function($scope) { | |
$scope.taxPercentage = 15; | |
$scope.price = 0; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment