Skip to content

Instantly share code, notes, and snippets.

@duycuong87vn
Last active August 29, 2015 13:57
Show Gist options
  • Save duycuong87vn/9813765 to your computer and use it in GitHub Desktop.
Save duycuong87vn/9813765 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>AngularJS review</title>
</head>
<body>
<div ng-controller="MyController">
Your name:
<input type="text" ng-model="username">
<button ng-click='sayHello()'>greet</button>
<hr>
{{greeting}}
</div>
</body>
</html>
function MyController($scope) {
$scope.username = 'Crunchbang';
$scope.sayHello = function() {
$scope.greeting = 'Hello ' + $scope.username + '!';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment