简体   繁体   中英

How to reference a dom element in ember route?

I was working on an EmberJS application developing.
I defined a route and a template for it

And there is a little button, which id is myBtn in that template

I wonder how and when i can reference that button in my route.js

If there is no way,i think i may wrote a single component and wrap it in that route(template),course,element reference in component is clearly and easily

Hope there is a hint for me

Thanks

In most cases there is no need for you to reference dom element (your button) in the route, your button and route should be loosely coupled it is how ember encourages building apps. Instead you should use actions/events to control your app or wrap it in component if you really need reference to dom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM