Zyring Day 15 – Making pages for each apartment

[Note: These are more in-depth (read: tedious) write-ups of my experience with each section of the Zyring project, leading on from my intro post on Zyring. This is mostly for my own benefit but could conceivably be of use to someone doing the project.]

Creating new pages for your apartments

This took me a while, as it was some time since I’d done the routing for the city pages. I had to create my new view (apartments.html), my new controller (apartments.js) and then sort out the routing in app.js. Then I made links from each apartment in the map and listings to the new page. Think I’m starting to get the hang of how routing works!

Backend endpoints for individual apartment API

Nice short tutorial, just having a look at what information the backend server has for each apartment (quite a lot, as it turns out).

Single apartment factory

This is an odd tutorial. The text looks unfinished, and says ‘Similar to the previous step, create another factory for the last backend call inside the script you created.’ I have no idea what step this is referring to. I decide to go for my standby method of just guessing what to do, and then hoping the next tutorial makes more sense…

My guess is that I need to wire things up to the backend server using the $resource object, as I did for the apartment lists for each city. After a lot of fiddling around trying to remember how to do this, I manage to dump all the apartment data into my view for each apartment:

Data for the single apartment view.

Data for the single apartment view.

Not pretty. But it works!

Getting information for individual apartments

Hang on, turns out that the next tutorial is exactly what I just did. So I’ve now got no idea what the ‘Single Apartment Factory’ tutorial is about. Never mind, if it’s important I’m sure I’ll find out later. I’m also feeling quite smug that I figured out to use a get rather than query method by myself, with no help from the tutorial (it took me a while though).

Wow, there’s only one tutorial left now (as well as going back and working out what my off-by-one problem with ‘Using the pager element to navigate’ is). Will leave this for another day, as I expect it will take some time to do all the styling and so on.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s