Pass Custom Context


Advertisements

Description

Framework7 allows you to pass custom context to any dynamic page or any loaded Ajax.

The data-context attribute is used to pass custom context where you need to put valid stringified JSON as shown below −

<a href = "interests.html" class = "item-link item-content" data-context = '{
   "sport": "Baseball", 
   "place": "Scotland", 
   "movies": "Science Fiction", 
   "actor": "Tom Cruise"
}'>Interests</a>

You can also pass custom context using View's router .load() method and context property in JavaScript as shown in the following instance −

mainView.router.load ({
   url: 'interests.html',
   context: {
      sport: 'Baseball',
      place: 'Scotland',
      movies: 'Science Fiction',
      actor: 'Tom Cruise'
   }
})
framework7_template7_pages.htm
Advertisements