unfortunately, this is not that easy :-)
It is much more a UI/Navigation related issue. let me do a much cleaner sample.

on the search page the user execute a search and gets back a bunch of results
each result contains a “ref” to the server side location where the client can 
get the result detail json.
the user clicks on a result and must be redirected to the details page
the details page now should call the server API to get the details but does not 
know how to call the server and where to call the server because the 
information is still on the previous page
more on this, since we need to retain the bookmarkability on client we need a 
way to have a unique URL for each detail…but we do not have information to 
uniquely identify it, unless we put in the url the whole “ref” of the details, 
that is not a problem it is only ugly.

.m
--
(no keyboard keys have been killed due to the really annoying OSX spell checker)

On 12/apr/2014, at 23:03, James Brewer <[email protected]<mailto:[email protected]>> 
wrote:

The answer to your question is that you use nested promises, which isn't the 
best idea. The main concern here is that two XHR calls is (by definition) twice 
as slow as a single call.

What I would recommend is actually making the API return a short summary of the 
details page in addition to `ref` and `description`. This way, you only make a 
single call.


On Sat, Apr 12, 2014 at 11:04 AM, Mauro Servienti 
<[email protected]<mailto:[email protected]>> wrote:
Hi all,

Let’s say that I have a remote api the when called using something like 
“/api/search?q=foo” returns something like:

{
   Results: [{
                ‘ref’: ‘/api/companies/12’,
                ‘description’: ‘sample company’
   }]
}

The above are search results, and the server is telling me where to go to 
retrieve details about the returned documents.
Now my requirement is to navigate to a page within my application to display 
details about the selected result, with the requirement that the details page 
must be “bookmarkable”.

The above “ref” value is not a client side uri, it identifies the resource for 
the remote server, in which way I can do some sort of mapping to route the 
request client side?
And more: when I route the request on the client how can I matain the ref value 
somewhere to to know what/where to call in the details page?

Cheers,
.m

--
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
James Brewer
http://www.brwr.org/

Software Engineer @ RealScout | What is RealScout?<http://vimeo.com/72791570>

Twitter twitter.com/jamesbrwr<http://twitter.com/jamesbrwr>
GitHub github.com/brwr<http://github.com/brwr>
StackOverflow 
stackoverflow.com/users/2052923/james-brewer<http://stackoverflow.com/users/2052923/james-brewer>
LinkedIn linkedin.com/in/jamesbrwr<http://linkedin.com/in/jamesbrwr>

→ My favorite RealScout search is Modern & High-Tech Homes in 
Atherton<https://kendeleon.realscout.com/categories/modern-high-tech?utf8=%E2%9C%93&loc=Atherton>

--
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to