make placeholder optional
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 24 Jan 2013 00:41:35 +0000 (01:41 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 24 Jan 2013 00:41:35 +0000 (01:41 +0100)
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>'+