Skill Level Intermediate
So what we need to do is essentially call that data with EJS and then go ahead and parse it through a template. If you take a look at our index.html file, you'll notice that we have the call to a script that brings in our library right here. You can see that file has been placed right over here. So we're going to need to modify this script.js file to make sure that we can bring in the data from a template as well as create a template.
So this is our for loop, and inside this for loop, we're going to go ahead and use this regular HTML, so we'll do a div with a class of artist right here, and then we'll close out that div here and then we'll just put a head line level four, close it out, so this is just regular HTML as well as a paragraph, so we'll do a paragraph and in here, we're going to use this data.artists information, and to use an actual sort of data element, then we use a less than sign and a percentage and then a equal sign.
So remember that this script is being called from our index.html file, and so relative to our index.html file, our EJS template is in the js folder, so that's why we have to put this js right here, and once we do that, we can render this out using our data, which will be from data.artists, and then our next step would be to select an element in our index.html document.
So if you remember, this index.html, notice that I've added the library right here, but then it also has a div with a class of artists that we can target, so I'll just go ahead and do that by using a document.querySelector and looking for something with a class of artists, and then I'll change the innerHTML to be equal to our result that we get from combining our data with our template.
Now if you have some ideas for this weekly series, and maybe you want to share with me some questions you've been asked or have asked in interviews, connect with me in LinkedIn or just about any other social media network like Twitter or GitHub at planetoftheweb.
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.