How to divide the data by a gap



  • For example, there are three fields:

    • Name
    • Name
    • Fatherhood

    How to correctly draw a conclusion in such a way that the data are within one element separated by a gap, provided that a field may not be filled.

    <input ng-model="user_name" md-input />
    <input ng-model="user_last_name" md-input />
    <input ng-model="user_father_name" md-input />
    

    <span class="sub-heading" id="user_edit_position">{{user_name}} {{user_last_name}} {{user_father_name}}</span>

    If you do so, there will be gaps even if there is no field filled. What's the right thing to do?



  • Simple way: at the beginning and end of span.innerHTML, to set the gap and the result will always look the same. This will work because the gaps in HTML are transformed into single gaps (whitespace collapse)

    <span class="sub-heading" id="user_edit_position"> {{user_name}} {{user_last_name}} {{user_father_name}} </span>
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2