aurelia

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}

how to install typescript definitions from github repo

萝らか妹 提交于 2019-12-02 02:45:22
问题 how do you install the typescript defs for a library like aurelia-validatejs? Like the I did the npm install aurelia-validatejs --save to add it to the package.json and node_modules folders. Is there a typings command to get the typescript definitions into the typings.json and typings/globals folder? If not how can I do it. The library src and typescript exports are located at in the aurelia/validatejs github repo In case its relevant, I am playing in a project based on the aurelia webpack

Aurelia Custom Attribute with setAttribute method()

萝らか妹 提交于 2019-12-02 02:03:24
It seems Aurelia is not aware when I create and append an element in javascript and set a custom attribute (unless I am doing something wrong). For example, const e = document.createElement('div'); e.setAttribute('custom-attr', 'some value'); body.appendChild(e); Is there a way to make Aurelia aware of this custom attribute when it gets appended? A little background: I am creating an app where the user can select their element type (e.g. input, select, checkbox etc.) and drag it around (the dragging is done in the custom attribute). I thought about creating a wrapper <div custom-attr repeat

Two way binding not working on bootstrap-select with aurelia

人盡茶涼 提交于 2019-12-02 01:37:06
I have managed to create a custom element to use the boostrap-select element. However, I can pass/bind values to it from the main view (parent) but I am unable to get the selection out from the element when I use two-way binding. My custom element is: import {inject, customElement, bindable} from 'aurelia-framework'; import * as selectpicker from 'bootstrap-select' @customElement('select-picker') export class BootStrapSelectPicker { @bindable selectableValues = null; @bindable newValue = null; @bindable selectedValue = 10; constructor(){ } attached(){ $('.selectpicker').selectpicker({ style:

Update Aurelia observed property on change to containing array

a 夏天 提交于 2019-12-02 00:12:27
问题 I have a simple class, Event with a computed property: import moment from 'moment'; export class Event { constructor(data) { Object.assign(this, data); } get playedFromNow() { return moment(this.CreateDate).fromNow(); } } playedFromNow just returns a string based on the CreateDate property, like 7 minutes ago . The viewmodel gets an array of events and the view renders the events. The array gets updated via websockets every time a new event occurs (every few minutes). <div repeat.for="event

how to install typescript definitions from github repo

最后都变了- 提交于 2019-12-01 23:06:19
how do you install the typescript defs for a library like aurelia-validatejs? Like the I did the npm install aurelia-validatejs --save to add it to the package.json and node_modules folders. Is there a typings command to get the typescript definitions into the typings.json and typings/globals folder? If not how can I do it. The library src and typescript exports are located at in the aurelia/validatejs github repo In case its relevant, I am playing in a project based on the aurelia webpack-typescript skeleton and I want to get validatejs and or other plugins working! It would be really cool if

Capture div containing inline svg and download it as image

强颜欢笑 提交于 2019-12-01 22:43:11
I wrote code to capture a screenshot of a page using html5. Everything is fine except when the page contains an svg. When I convert svg to inline svg after that screenshot is not capturing the inline svg. Please check https://jsfiddle.net/7bqukhff/4/ <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script> <script src="https://github.com/niklasvh/html2canvas/releases/download/0.5.0-alpha1/html2canvas.svg.js"></script> <script src="https://github.com/niklasvh/html2canvas/releases/download/0.5.0-alpha1/html2canvas.js"></script> <script src="https://ajax

Update Aurelia observed property on change to containing array

痞子三分冷 提交于 2019-12-01 22:15:50
I have a simple class, Event with a computed property: import moment from 'moment'; export class Event { constructor(data) { Object.assign(this, data); } get playedFromNow() { return moment(this.CreateDate).fromNow(); } } playedFromNow just returns a string based on the CreateDate property, like 7 minutes ago . The viewmodel gets an array of events and the view renders the events. The array gets updated via websockets every time a new event occurs (every few minutes). <div repeat.for="event of events"> <div class="media-body"> <h4 class="media-heading">${event.title} <small>${event

Aurelia dynamic binding

ε祈祈猫儿з 提交于 2019-12-01 21:43:10
I've created a custom element that generates tabular data. For good reasons, this generates the actual HTML and inserts into the DOM without using a template. I need to attach click observers to specific elements to I can run a function in the custom element in response to a click. If using a template, I'd use click.delegate, but I can't use that with generated HTML. How do you attach an event handler with Aurelia other than by using jQuery? I know this answer is late, but in case this hasn't been (properly) solved yet and/or someone else finds this in the future: In order to make any aurelia

Remote Service in Aurelia Component Lifecycle

我们两清 提交于 2019-12-01 21:31:19
I'm trying to figure out at what point of the component lifecycle do I call into a remote service? I'm looking to create components that are tied to a remote service so instead of having my remote service be called using the activate callback as part of the screen activation lifecycle, each component would call the remote service themselves. They would show a loading animation until they have received the data from the remote service. Use the attached callback. When a viewmodel has an attached method, aurelia will call it after the view has been added to the DOM. Alternatively you could use