O'Reilly logo

PhoneGap by Andrew Lunny

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

Time for action – Food detail view

  1. First things first, let's get a local copy of mustache.js. We could clone the entire Git repository, but we only need a single JavaScript file. We can grab that one directly from https://github.com/janl/mustache.js/raw/master/mustache.js. Download that file and save it in your sites_without_servers directory.
  2. Next, include that file in your index.html—add this <script> tag just before your closing </body> tag:
    <script src="mustache.js"></script>
  3. Now let's write our first Mustache template. Create a new file called food_detail.mustache and fill it with the following code:
    <h2>{{ foodName }}</h2>
      <p>{{ foodName }} is my favorite food. I particularly enjoy it in the {{ timeOfDay }}.</p>
  4. This file is known as our template ...

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