AnsweredAssumed Answered

ESRI API Dojo \ on VS data-dojo-attach-event

Question asked by ARROCAL on Sep 29, 2016
Latest reply on Sep 29, 2016 by rscheitlin

Hello;

 

I am studying the ArcGIS API javascript to create widgets and I don`t understand what is the difference between Dojo \ on in the Widget.js file and data-dojo-attach-event in the template.html file.

 

My questions:

 

When Dojo \ on is used and when data-dojo-attach-event?

 

What is the difference between these two snippets of code?

 

In Widget.js file:

 

on(this.alertButton, "click", myFunction ())
myFunction () {
topic.publish("alertUser", "I am alerting you.");
}

 

In template.html:

 

<button data-dojo-attach-point= 'alertButton' data-dojo-attach-event='click: myFunction '>press me</button>

 

Thanks.

Outcomes