lundi 19 septembre 2016

DOM Node of the outlet corresponding to the (Ember) Route

Please excuse my ignorance, I am fairly new to ember.

Once a route has rendered, I would like to know the DOM node of the corresponding outlet.

Let's consider the project structure as below mentioned.

|____adapters
| |____application.js
|____app.js
|____index.html
|____models
| |____rental.js
|____resolver.js
|____router.js
|____routes
| |____rentals
| | |____rental.js
| |____rentals.js
|____styles
| |____app.css
|____templates
| |____application.hbs
| |____rentals
| | |____rental.hbs
| |____rentals.hbs

Let's consider the content of application.hbs, rentals.hbs and rental.hbs as below mentioned.

// application.hbs
<div class="container">  
  
</div>

// rentals.hbs
<div>
 Yo!
 
</div>

// rental.hbs
<div>
 So you are here!
</div>

So when /rentals is rendered, I would like know the DOM node corresponding to the in the application.hbs.

Similarly when /rentals/rental is rendered, I would like know the DOM node corresponding to the in the rentals.hbs.

May be some sort of hook/callBack that will get executed when the route is rendered and pass the DOM node as an argument.

Any pointer would be helpful.

Thanks!




Aucun commentaire:

Enregistrer un commentaire