samedi 23 septembre 2017

Go / Golang - If Else Statement on HTML Template: I would like to show message in else statement

If Else Statement on HTML file

I would like to display the h4 message (else statement in index.gohtml) if no modifications are present. It works on the navbar (reference mdl.gohtml excerpt)

Guidance would be appreciated. If you have any additional reading on the subject, please feel free to include. Thanks


mdl.gohtml

<div class="mdl-layout mdl-layout mdl-js-layout mdl-layout--fixed-header">
  <!--Header-->
  
  <!--Content-->
  <main class="mdl-layout__content">
    
    <!--Footer-->
    
  </main>
</div>


Data.go

type Data struct {
    Account      *models.Account
    Modification *models.Modification
    Yield        interface{}
}


Index.gohtml


  
    <div class="mdl-cell mdl-cell--4-col mdl-cell--4-col-tablet mdl-cell--4-col-desktop mdl-card mdl-shadow--6dp">
      <div class="mdl-card__title">
        
      </div>
    </div>
  

  <div class="mdl-cell mdl-cell--4-col-phone mdl-cell--4-col-tablet mdl-cell--6-col-desktop mdl-card mdl-shadow--6dp">
    <h4>NO CONTRIBUTIONS!</h4>
  </div>


Aucun commentaire:

Enregistrer un commentaire