O'Reilly logo

KnockoutJS by Example by Adnan Jaswal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required