make placeholder optional
[angular-drzb] / app / js / directives.js
index 88d5653..67bec43 100644 (file)
@@ -42,8 +42,9 @@ angular.module('myApp.directives', []).
 '  <div class="control-group">'+
 '    <label class="control-label" for="'+m+'">'+attrs.label+'</label>'+
 '    <div class="controls">'+
-'      <input type="'+my_type+'" id="'+m+'" ng-model="'+m+'" placeholder="'+attrs.placeholder+'"'
+'      <input type="'+my_type+'" id="'+m+'" ng-model="'+m+'"';
                        ;
+                       if ( attrs.placeholder ) html += ' placeholder="' + attrs.placeholder + '"';
                        if ( attrs.ngRequired ) html += ' ng-required="' + attrs.ngRequired + '"';
                        html += '>'+
 '    </div>'+