Angular: Empty Fiddle
http://angularjs.org/
HTML
<script id="partials/addressform.html" type="text/ng-template">
directive of type {{type}} with value {{type.value}}<br>
</script>
<div ng-controller="MyCtrl">
<address-form type="billing"></address-form>
<address-form type="delivery"></address-form>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
angular.module('myApp').directive('addressForm', function() {
return {
restrict: 'E',
templateUrl: 'partials/addressform.html',
scope: {
type: '='
}
};
});
angular.module('myApp').controller('MyCtrl', function($scope) {
$scope.billing = { type: 'billing type', value: 'abc' };
$scope.delivery = { type: 'delivery type', value: 'def' };
});