Displaying address details
The second feature is about retrieving and displaying the address details. To implement this feature, we will:
- Modify the model to capture address details
- Extract the address details from Google Maps APIs place object and populate the model
- Update the view to display the address details
Let's get started by modifying the model we created previously to capture address details. First, create a generic function to construct the address model. The address model should have attributes that you want to capture and display, such as street number and name. Here is our implementation:
/* generic model for address */ var AddressModel = function() { this.location = ko.observable(); this.streetNumber = ko.observable(); this.streetName ...
Get KnockoutJS by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.