A tour of the basics
A lightweight JavaScript library
Leverages HTML attributes
Performs dynamic HTTP requests
Enables partial updates to web pages
app.py
items = [
{"id": 1, "name": "Item 1"},
{"id": 2, "name": "Item 2"},
{"id": 3, "name": "Item 3"},
]
@app.route("/")
def index():
return render_template("index.html", items=items)
index.html (the good bits)
{% for item in items %}
-
{{ item.name }}
{% endfor %}
Load the form
app.py
edit.html
index.html
Save the form
edit_item.html
app.py
Extract 'item.html' template
{% for item in items %}
{% include 'item.html' %}
{% endfor %}
Cancel the edit
edit_item.html
app.py
index.html
index.html
app.py
item.html
item_done.html
A minimal tool for composing behavior in HTML markup
A collection of 15 attributes, 6 properties, and 2 methods.
Let's add some client side interactivity
edit_form.html
edit_form.html
edit_form.html
index.html
item.html
Content...
Hello 👋
...
Questions?