Reputation: 7449
I want to add a click listener to a hyperlink that calls the function from the controller:
View:
{
xtype: 'component',
autoEl:{
html: '<a href="#">Forgot password?</a>',
listeners: {
click: 'forgotPassword'
}}
}
Controller:
forgotPassword: function () {
alert('HHHH');
this.getView().destroy();
}
But it doesn't work?
Upvotes: 0
Views: 2607
Reputation: 74126
autoEl
object.element: 'el'
to your listener.For example:
{
xtype: 'component',
html: '<a href="#">Forgot password?</a>'
listeners: {
element: 'el',
click: 'forgotPassword'
}
}
https://fiddle.sencha.com/#fiddle/1clt
Upvotes: 4