Edit in JSFiddle

<div ng-controller="myCtrl">
  <text-box on-submit="submit(text, len)"></text-box>
  <text-box on-submit="submit(text, len)"></text-box>
</div>
var myApp = angular.module('myApp', []);

myApp.controller('myCtrl', ['$scope', function ($scope) {
  $scope.submit = function (text, len) {
  	alert(text + ', ' + len);
  };
}]);

myApp.directive('textBox', function() {
  return {
    restrict: 'E',
    scope: {
    	onSubmit: "&"
    },
    template: '<input type="text" ng-model="value"/><button type="submit" ng-click="onSubmit({ text: value, len: value.length })">Submit!</button>'
  }
});