Category menu items query

You are now ready to add the horizontal menu and query for the categories list:

  1. Add the HTML in bold to index.html:
<div class="app-main">  <div>    <ul id="menu"></ul>  </div></div>
  1. Create a file named app.js, then implement a categories query and execute it when the app loads:
const templatesCache = {};function render(props) {  return function(tok, i) { return (i % 2) ? props[tok] : tok; };}// a basic templating approach that uses regex for formatting specified props into the relevant placeholders in the templatefunction renderTemplate(templateName, props) {  let template = templatesCache[templateName];  if (!template) {    // reserve templates in cache for future quicker access template = $(`script[data-template="${templateName}"]`).text() ...

Get Hands-On Full-Stack Web Development with ASP.NET Core 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.