Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<textbox multiline></textbox>
<textbox></textbox>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('textbox', function() {
return {
restrict:'E',
template: "<div></div>",
compile: function compile(tElement, tAttrs) {
console.log(tAttrs.multiline, tAttrs );
var textbox;
if (tAttrs.hasOwnProperty("multiline")) {
textbox = angular.element('<textarea></textarea>');
} else {
textbox = angular.element('<input type="text"/>');
}
tElement.append(textbox);
return function(scope, iElement, iAttrs) {}
}
}
});
function MyCtrl($scope) {
}