Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Hello Angular!

Data Binding and Responding to Scope Changes

Code Block
html
html

<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
javascript
javascript

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

...