mercredi 25 mai 2016

How to organize api requests right in Emberjs?

Recently I met with EmberJS. There are a few questions, I can not find answers in the documentation.

  1. Authorized user retrieves data from the server at /api/profile when the page loads. However, if I try to do it through ember api method, I get a request for api/profiles. How to make the right query? I need to get the user structure, save it in 'profile' model and use it in routes and components.

  2. Suppose the first question dealt with. Next there is a problem with the templates. There is root application template. There is "nav-bar" component, which indicates the name of the authorized user. So, how to put the model of user data in this component? This template is not in a route. Here is template so I need to pass user scheme into it.

    <div id = "wrapper">   </div>
    
    

I think maybe i don't get something in architecture of Embers, please help me!

Thank you in advance!




Aucun commentaire:

Enregistrer un commentaire