Is there a way to call the methods in view or component in the controller?


#1

And how can a controller nofity the view or the component that the method executed by the controller ended? Thanks


#2

In Ember, is it a good practice to deal with DOM in the view?


#3

New update, in my floor template, I wrote an action:

<a href="javascript:void(0)" {{action 'showTip' target='view'}}>Test</a>

And in FloorView’s actions hash, I defined the showTip method:

showTip: function() {
    console.log('in showTip');
}

But when I clicked this link, nothing happened in the console. Is there anything I’ve done wrong? Thanks


#4

I found the error. So now I wonder whether I could call the method in a component?


#5

Ember tends to use bindings for updating the view. You should bind the part of your view that you want to update to the controller and then when your action has finished you can update the binding and the view will render automatically.


#6

Thanks for your answer! But in my application, there needs to be some animation effect when the view or the component got showing or hiding, so just update a boolean value to render the view can’t meet my needs. Any solution?