Reactivity
Declare state
Aurelia 2
<h1>Hello ${name}</h1>
Aurelia 1
<template>
<h1>Hello ${name}</h1>
</template>
Update state
Aurelia 2
<h1>Hello ${name}</h1>
Aurelia 1
<template>
<h1>Hello ${name}</h1>
</template>
Computed state
Aurelia 2
<div>${doubleCount}</div>
Aurelia 1
<template>
<div>${doubleCount}</div>
</template>
Templating
Minimal template
Aurelia 2
<h1>Hello world</h1>
Aurelia 1
<template>
<h1>Hello world</h1>
</template>
Styling
Aurelia 2
.title {
color: red;
}
Aurelia 1
.title {
color: red;
}
Loop
Aurelia 2
<ul>
<li repeat.for="color of colors">${color}</li>
</ul>
Aurelia 1
<template>
<ul>
<li repeat.for="color of colors">${color}</li>
</ul>
</template>
Event click
Aurelia 2
<p>Counter: ${count}</p>
<button click.trigger="incrementCount">+1</button>
Aurelia 1
<template>
<p>Counter: ${count}</p>
<button click.trigger="incrementCount()">+1</button>
</template>
Dom ref
Aurelia 2
<input ref="inputElement" />
Aurelia 1
<template>
<input ref="inputElement" />
</template>
Conditional
Aurelia 2
<button click.trigger="nextLight()">Next light</button>
<p>Light is: ${light}</p>
<p switch.bind="light">
You must
<span case="red">STOP</span>
<span case="orange">SLOW DOWN</span>
<span case="green">GO</span>
</p>
Aurelia 1
<template>
<button click.trigger="nextLight()">Next light</button>
<p>Light is: ${light}</p>
<p>
You must
<span if.bind="light === 'red'">STOP</span>
<span if.bind="light === 'orange'">SLOW DOWN</span>
<span if.bind="light === 'green'">GO</span>
</p>
</template>
Lifecycle
On mount
Aurelia 2
<p>Page title is: ${pageTitle}</p>
Aurelia 1
<template>
<p>Page title is: ${pageTitle}</p>
</template>
On unmount
Aurelia 2
<p>Current time: ${time}</p>
Aurelia 1
<template>
<p>Current time: ${time}</p>
</template>
Component composition
Props
Aurelia 2
<user-profile
name.bind
age.bind
favourite-colors.bind="colors"
is-available.bind="available"
></user-profile>
Aurelia 1
<template>
<require from="./user-profile"></require>
<user-profile
name.bind="name"
age.bind="age"
favourite-colors.bind="colors"
is-available.bind="available"
></user-profile>
</template>
Emit to parent
Aurelia 2
<p>Can I come ?</p>
<answer-button action-handler.bind="handleAnswer"></answer-button>
<p style="font-size: 50px">${isHappy ? "😀" : "😥"}</p>
Aurelia 1
<template>
<require from="./answer-button"></require>
<p>Can I come ?</p>
<answer-button action-handler.call="handleAnswer(reply)"></answer-button>
<p style="font-size: 50px">${isHappy ? "😀" : "😥"}</p>
</template>
Slot
Aurelia 2
<funny-button>Click me !</funny-button>
Aurelia 1
<template>
<require from="./funny-button"></require>
<funny-button>Click me !</funny-button>
</template>
Slot fallback
Aurelia 2
<funny-button></funny-button>
<funny-button>Click me !</funny-button>
Aurelia 1
<template>
<require from="./funny-button"></require>
<funny-button></funny-button>
<funny-button>Click me !</funny-button>
</template>
Context
Aurelia 2
<h1>Welcome back, {{ user.username }}</h1>
<user-profile />
Aurelia 1
Missing snippet Help us to improve Component Party 
Form input
Input text
Aurelia 2
<p>${text}</p>
<input value.bind />
Aurelia 1
<template>
<p>${text}</p>
<input value.bind="text" />
</template>
Checkbox
Aurelia 2
<input id="is-available" type="checkbox" checked.bind="isAvailable" />
<label for="is-available">Is available</label>: ${isAvailable}
Aurelia 1
<template>
<input id="is-available" type="checkbox" checked.bind="isAvailable" />
<label for="is-available">Is available</label>: ${isAvailable}
</template>
Radio
Aurelia 2
<div>Picked: ${picked}</div>
<input id="blue-pill" checked.bind="picked" type="radio" value="blue" />
<label for="blue-pill">Blue pill</label>
<input id="red-pill" checked.bind="picked" type="radio" value="red" />
<label for="red-pill">Red pill</label>
Aurelia 1
<template>
<div>Picked: ${picked}</div>
<input id="blue-pill" checked.bind="picked" type="radio" value="blue" />
<label for="blue-pill">Blue pill</label>
<input id="red-pill" checked.bind="picked" type="radio" value="red" />
<label for="red-pill">Red pill</label>
</template>
Select
Aurelia 2
<select value.bind="selectedColorId">
<option value="">Select A Color</option>
<option
repeat.for="color of colors"
value.bind="color.id"
disabled.bind="color.isDisabled"
>
${color.text}
</option>
</select>
Aurelia 1
<template>
<select value.bind="selectedColorId">
<option value="">Select A Color</option>
<option
repeat.for="color of colors"
value.bind="color.id"
disabled.bind="color.isDisabled"
>
${color.text}
</option>
</select>
</template>
Webapp features
Render app
Aurelia 2
<!doctype html>
<html>
<head>
<script type="module" src="./main.ts"></script>
</head>
<body>
<app></app>
</body>
</html>
Aurelia 1
Missing snippet Help us to improve Component Party 
Fetch data
Aurelia 2
<template promise.bind="useFetchUsers.fetchData()">
<p pending>Fetching users...</p>
<p catch>An error ocurred while fetching users</p>
<ul then.from-view="users">
<li repeat.for="user of users">
<img src.bind="user.picture.thumbnail" alt="user" />
<p>${ user.name.first } ${ user.name.last }</p>
</li>
</ul>
</template>
Aurelia 1
<template>
<p if.bind="isLoading">Fetching users...</p>
<p if.bind="error">An error ocurred while fetching users</p>
<ul if.bind="users">
<li repeat.for="user of users">
<img src.bind="user.picture.thumbnail" alt="user" />
<p>${ user.name.first } ${ user.name.last }</p>
</li>
</ul>
</template>