Skip to content

Instantly share code, notes, and snippets.

View martonsagi's full-sized avatar

Márton Sági martonsagi

View GitHub Profile
<template>
<require from="./inline-view"></require>
<inline-view></inline-view>
</template>
@martonsagi
martonsagi / app.html
Created September 9, 2016 14:10
Global attach() handler for viewmodels
<template>
<require from="./extended-view"></require>
<div class="container-fluid">
<h4 class="page-header">Global attach() handler for viewmodels </h4>
<ul class="list-group">
<li class="list-group-item">
<compose view-model="./extended-view"></compose>
@martonsagi
martonsagi / app.html
Created September 9, 2016 21:00
Permission check on two routes with the same module
<template>
<div class="container-fluid">
<h4 class="page-header">Permission check on two routes with the same module</h4>
<a class="btn btn-primary" href="#/route1">Route #1</a>
<a class="btn btn-danger" href="#/route2">Route #2</a>
<div class="panel">
<div class="panel-body">
@martonsagi
martonsagi / app.html
Last active September 10, 2016 22:00
Update Aurelia binding when properties change
<template>
<require from="./car-list"></require>
<div class="container-fluid">
<h4 class="page-header">Cars: ${cars.length} | Counter: ${counter}</h4>
<car-list cars.bind="cars"></car-list>
</div>
</template>
@martonsagi
martonsagi / app.html
Created September 24, 2016 07:01
Aurelia - Accessing Custom Component Data/Methods with EventAggregator
<template>
<require from="component"></require>
<div repeat.for="item of components">
<label>${item.name}${item.id}</label>: <component id.bind="item.id"></component>
</div>
<hr>
<button class="btn btn-primary" click.delegate="SubmitData({id: 1})">Submit data for Component#1</button>
<hr>
<button class="btn btn-success" click.delegate="SubmitData({all: true})">Submit data for All Component</button>
@martonsagi
martonsagi / app.html
Last active October 5, 2016 09:03
Aurelia HTML only element default values
<template>
<require from="./cust-elem.html"></require>
<cust-elem param1.bind="value1" param2.bind="value2"></cust-elem>
</template>
@martonsagi
martonsagi / app.html
Created October 27, 2016 12:09 — forked from geleto/app.html
Aurelia - change to a bound repeat input element is applied to the VM a second time after the element has been deleted.
<template>
<div repeat.for="msg of messages">
<input type="text" value.bind="msg" input.delegate="onMessageChanged(msg, $index)">
</div>
</template>
@martonsagi
martonsagi / app.html
Last active November 1, 2016 10:08
Aurelia NavBar Authentication Example
<template>
<require from="./nav-bar"></require>
<require from="./nav-bar-compose.html"></require>
<require from="./nav-bar-function.html"></require>
<nav-bar-function if.bind="mode === 'function'"
router.bind="router"
logged-in.bind="loggedIn"
toggle-login.call="toggleLogin()">
@martonsagi
martonsagi / app.html
Last active November 3, 2016 07:19
Aurelia Replaceable parts
<template>
<require from="./my-component"></require>
<h4>Default template</h4>
<my-component></my-component>
<hr>
<h4>Custom template</h4>
@martonsagi
martonsagi / app.html
Created November 5, 2016 23:34
Aurelia - conditional checkbox binding
<template>
<ul>
<li repeat.for="item of items">
<label><input type="checkbox" checked.bind="item.status === 'EnumValue'" /> Checkbox</label>
</li>
</ul>
</template>