Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
List group - Blog
import {bindable, processContent} from 'aurelia-templating';
import {FEATURE} from 'aurelia-pal';
//This custom attribute was created by Jeremy Danyow as a part of this
//stackoverflow answer
export class ListGroup {
@bindable itemsSource = null;
@bindable defaultValue = model => "";
function makePartReplacementFromContent(viewCompiler, viewResources, element, behaviorInstruction) {
const content = element.firstElementChild;
if (content) {
//note: In the latest version of aurelia this can be done in a cleaner way using DOM.createTemplateElement() method.
const template = document.createElement('template');
// support browsers that do not have a real <template> element implementation (IE)
// indicate the part this <template> replaces.
template.setAttribute('replace-part', 'item-template');
// replace the element's content with the <template>
element.insertBefore(template, content);
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment