I have this link-to that will be enabled/disabled depending on the property "linkDisabled". Initially the property will be true and this link-to will be disabled.
{{#link-to "databinding2" disabled=linkDisabled}}Databinding2{{/link-to}}
Whenever I click on this button I want to toggle the link between disable and enable without reloading any component.
<button {{action 'changeLinkState'}} >Click here</button>
This is how I want to handle it in the controller.
App.ApplicationController=Ember.Controller.extend({
linkDisabled:true,
actions:{
changeLinkState:function(){
if(this.linkDisabled==true)
{
this.linkDisabled=false;
}
else
{
this.linkDisabled=true;
}
}
}
});
Is it possible to do so without making asynchronous call?
As the property linkDisabled is being used in {{#link-to}}, so, it's throwing error when I try to modify it true or false.
Uncaught Error: Assertion Failed: You must use Ember.set() to set the `linkDisabled` property (of <App.ApplicationController:ember294>) to `false`.
What's the proper way to do it?
Aucun commentaire:
Enregistrer un commentaire