Template - RomainValy/ToDoMVC-OpenclassRoom-project GitHub Wiki
Table of Contents
Template
Sets up defaults for all the Template methods such as a default template
escapeHtmlChar
Parameters
chrArray get the escape Html character
defaultTemplate
Parameters
defaultTemplatestring push a default template of a TODO on the DOM
show
Creates an HTML string and returns it for placement in your app.
NOTE: In real life you should be using a templating engine such as Mustache or Handlebars, however, this is a vanilla JS example.
Parameters
dataObject The object containing keys you want to find in the template to replace.
Examples
view.show({
id: 1,
title: "Hello World",
completed: 0,
});
Returns string HTML String of an element
itemCounter
Displays a counter of how many to dos are left to complete
Parameters
activeTodosnumber The number of active todos.
Returns string String containing the count
clearCompletedButton
Updates the text within the "Clear completed" button
Parameters
completedTodosNumber The number of completed todos.
Returns string String containing the count
app
Export to window