Hello Angular!
Data Binding and Responding to Scope Changes
Code Block | ||||
---|---|---|---|---|
| ||||
<html>
<head>
<script src="js/angular.js"></script>
<script src="js/app.js"></script>
<link rel="stylesheet" href="css/bootstrap.css">
</head>
<body ng-app>
<div ng-controller="MyCtrl">
<input type="text" ng-model="name" placeholder="Enter your name">
<p>{{greeting}}</p>
</div>
</body>
</html>
|
Code Block | ||||
---|---|---|---|---|
| ||||
function MyCtrl($scope) {
$scope.name = "";
$scope.$watch("name", function(newValue, oldValue) {
if (newValue.length > 0) {
$scope.greeting = "Greetings " + newValue;
}
});
}
|
Why AngularJS?
TODO:
What is the use case for this technology from the developers point of view
...