Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="myApp">
  <div ng-controller="test">
    
    <button xxx c="get($search)">click me</button>
  </div>
</body>
</html>
 
var myApp = angular.module('myApp', ['ng']);
myApp.controller('test', function($scope, $http) {
  $scope.get = function(search) {
    console.log(search);
    $http.get('http://jsbin.com/');
  };
}).directive('xxx', function() {
  return {
    restrict: 'A',
    link: function(scope, elem, attr) {
      var searchScope = scope.$new();
      searchScope.$search = 'search text ...';
      elem.bind('click', function(e) {
        searchScope.$eval(attr.c);
      });
    }
  };
});
Output

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

Dismiss x
public
Bin info
niksunpro
0viewers