How do I call a function from a button click event in an application customizer?

Iron Contributor

So I have an application customizer that renders some html to the topPlaceholder like this:

  let message = "Please complete the information in the 'Site Information' list <a href='" + editFormUrl + "'>here</a> so that your site can be listed in the Global Site Directory.";

                this._topPlaceholder.domElement.innerHTML = `

              <div class="${styles.app}">

                  <div class="ms-bgColor-themeDark ms-fontColor-white ${styles.top}">

                    <i class="ms-Icon ms-Icon--Info" aria-hidden="true"></i> ${message}

                    <button onClick=${ this.removeCustomizer }>Dont't show this again! </button>

                  </div>

                  </div>

 

                </div>`;

 

 

When the use clicks on the button, nothing happens. I’ve tried this.removeCustomizer, this.removeCustomizer(),this.removeCustomizer .bind(this). Nothing seems to work.

 

In the console I see a message :

 Uncaught SyntaxError: Unexpected token }

 

I'm trying to do what the js-application-run-once  sample does, but OI want the user to click a button to have the extension removed. 

 

How Do I call a function from a button click event in an application customizer?

0 Replies