AngularJS Example

by basarat

HTML

<div ng-app="myApp">
  <div>
    {{ 'asdfasdfasdf' | greet:'' }}
  </div>
</div>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<style>
​.ng-invalid { border: 1px solid red; }​

JavaScript

// declare a module
var myAppModule = angular.module('myApp', []);

// configure the module.
// in this example we will create a greeting filter
myAppModule.filter('greet', function() {
 return function(name,param1) {
     if(!param1){
         param1 = '';
     }
    return 'Hello, ' + name + '!' + '  ' + param1;
  };
});