AngularJS Live Example

by Anov Siradj

HTML

<script src="http://code.angularjs.org/angular-0.9.19.min.js" ng:autobind></script>
<script>
angular.service('Greeter', function($resource){
  return $resource(
    'http://angularjs.org/greet.php', 
    {callback: 'JSON_CALLBACK'},
    {
      get: {method:'JSON'}
    });
});
function MyCtrl(Greeter){
    this.greet = function(){
      Greeter.get({name:this.name}, function(response){
        alert(response.greeting);
      });
    };
}
</script>

<div ng:controller="MyCtrl">
Your name: 
  <input type="text" name="name" value="World"/>
  <button ng:click="greet()">greet</button>
</div>

CSS

body { font-family: Arial,Helvetica,sans-serif; }
body, td, th { font-size: 14px; margin: 0; }
table { border-collapse: separate; border-spacing: 2px; display: table; margin-bottom: 0; margin-top: 0; -moz-box-sizing: border-box; text-indent: 0; }
a:link, a:visited, a:hover { color: #5D6DB6; text-decoration: none; }