aurelia-templating

How to tear down an enhanced fragment

爱⌒轻易说出口 提交于 2020-01-01 03:47:48
问题 I am working on an existing SPA where we replace components with Aurelia components step by step. We use the enhance API of the TemplatingEngine . That works pretty well but we also need to tear down those enhanced fragments (remove event listeners, ...) when moving to another part of the application (no page reload). My idea is to keep the aurelia instance in the page and reuse it. Currently I enhance fragments like this: function enhanceFragment(targetElement) { function proceed() { let

In Aurelia, can a slot be used in a repeat.for binding?

微笑、不失礼 提交于 2019-12-07 11:15:00
问题 I'd like to create a custom element that loops through an array and applies the to each item in the array. For example, the view template of the custom element would contain something like: <div repeat.for="i of items"> <div with.bind="i"> <slot></slot> </div> </div> When I remove the repeat.for and with.bind attributes, the slot displays a single time. Is there a way to make it repeat for each item in the list? 回答1: No, you cannot use slots with repeat.for or bind today. To do this you have

In Aurelia, can a slot be used in a repeat.for binding?

喜欢而已 提交于 2019-12-05 17:55:32
I'd like to create a custom element that loops through an array and applies the to each item in the array. For example, the view template of the custom element would contain something like: <div repeat.for="i of items"> <div with.bind="i"> <slot></slot> </div> </div> When I remove the repeat.for and with.bind attributes, the slot displays a single time. Is there a way to make it repeat for each item in the list? No, you cannot use slots with repeat.for or bind today. To do this you have to use replaceable parts. For example: <div repeat.for="i of items"> <div with.bind="i"> <template

In Aurelia, can I bind a function from my containing view-model to be called by my custom element?

こ雲淡風輕ζ 提交于 2019-12-04 10:49:57
问题 I have a custom element which will take user input, and on [save] button click, I want to pass information to the parent view-model so I can send it to the server and move to the next section. I'm going to simplify this for example's sake: my-element.js : import { customElement, bindable } from 'aurelia-framework'; @customElement('my-element') @bindable('save') export class MyElement { } my-element.html : <template> <button click.delegate="save()">Click this</button> </template> parent-view

Customizing Aurelia to use .cshtml

一个人想着一个人 提交于 2019-12-02 09:39:32
问题 I found a very helpful article showing how to use Razor partials (cshtml) with aurelia. However, I could not get the code to run and learned from RobEisenberg comment that ConventionalViewStrategy.convertModuleIdToViewUrl had been deprecated. He commented "You want to use the ViewLocator service." I followed the gitHUb project and could not see that it was directly relevant to my using with MVC5 and Razor Partials. So I am confused. This is the example main.js file that I was hoping I could

Customizing Aurelia to use .cshtml

蓝咒 提交于 2019-12-02 04:57:39
I found a very helpful article showing how to use Razor partials (cshtml) with aurelia. However, I could not get the code to run and learned from RobEisenberg comment that ConventionalViewStrategy.convertModuleIdToViewUrl had been deprecated. He commented "You want to use the ViewLocator service." I followed the gitHUb project and could not see that it was directly relevant to my using with MVC5 and Razor Partials. So I am confused. This is the example main.js file that I was hoping I could tweak in order to route aurelia to the Home/Index/Index.cshtml instead of index.html import {LogManager}