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.
Solved! Go to Solution.
Alberto,
There are going to be limited times when you will use data-dojo-attach-event. The are a couple of reason for this:
When it comes down to the two snippets of code the function almost identically so there is little to no difference. It is more of a preference.
Alberto,
There are going to be limited times when you will use data-dojo-attach-event. The are a couple of reason for this:
When it comes down to the two snippets of code the function almost identically so there is little to no difference. It is more of a preference.