Now, we're ready to start building our user interface; we can do this by performing the following steps:
Open the
views.js
file from the public directory. We'll start with some helper code. You're familiar with the first part, but thetmpl
function is new. It's just a small helper function that we'll use to get our templates. We'll use this method for almost every view. Here's the code:_.templateSettings = { interpolate: /\{\{(.+?)\}\}/g }; function tmpl(selector) { return _.template($(selector).html()); }
Funnily enough, we're not going to use the
tmpl
function for the first view; the first view is the navigation view. Instead of creating atemplate
property and choosing atagName
property, we're setting theel
property. We make this property a selector for an element that already exists on the page, and that element will become the element for this view. When we click on the Add Podcast link, we'll want to display a form. To display this form, we'll navigate...