Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="https://raw.github.com/rmm5t/jquery-timeago/master/jquery.timeago.js"></script>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.3/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="Foo">
  <h5 class="page-header">Directive</h5>
  <abbr class="time-ago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
  
  <p>&nbsp;</p>
  
  <h5 class="page-header">Filter</h5>
  <div>{{'July 17, 2008' | timeAgo}}</div>
</body>
</html>
 
var app = angular.module("Foo", []);
app.directive("timeAgo", function($compile) {
  return {  
    restrict: "C",
    link: function(scope, element, attrs) {
      jQuery(element).timeago();
    }
  };
});
app.filter("timeAgo", function() {
  return function(date) {
    return jQuery.timeago(date); 
  };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
kwonpro
0viewers