aurelia-framework

Passing objects to next sibling components

瘦欲@ 提交于 2019-12-11 00:16:37
问题 My structure in AureliaJS of components is: <parent> <child1> <child2> </parent> I have an object in child1 which I get with ajax requests: export class Child1 { fechedObject = {}: } I need this property with two-way binding and observable in the second component export class Child2 { // I need this fechedObject here } What is the best approach to get it? 回答1: I believe the best approach here is using two-way binding on both child models, to bind the model via two-way binding in the parent.

aurelia-dialog error with the release version and CLI

烂漫一生 提交于 2019-12-10 14:48:30
问题 I'm facing a problem when using the new aurelai release : I created a new app using : au new myApp I installed aurelia-dialog via npm When I import aurelia-dialog and try to run the app using au run --watch I get htis error : [Error: ENOENT: no such file or directory, open 'C:\src\ai-dialog.js'] Any idea ? 回答1: The reason this is happening is because the package is a CommonJS package. See: http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/10 Edit your aurelia

Aurelia CLI PWA with Webpack and Workbox

心不动则不痛 提交于 2019-12-08 05:37:59
问题 Last night I attempted to create a PWA using the latest aurelia-cli (version 0.32.0). I created a custom setup with au new that uses Webpack and TypeScript. After that I followed the Workbox with Webpack instructions from Google. npm install workbox-cli --saveDev npm install workbox-webpack-plugin --saveDev service worker is running offline fails doesn't find webpack-dev-server.js (not in dist), app.xxx.bundle.js and vendor.asdf.js are not in the generated sw.js even though in dist folder au

Create a new instance of a class that is using dependency injection in Aurelia

余生长醉 提交于 2019-12-07 14:45:26
问题 I want to create a factory that is able to create a new instance of a class (MyClass, implementing an abstract class) that is using dependency injection. I would like the factory to look like this: Factory export class Factory { public static makeMyClass() { return new MyClass(); } } However, the EventAggregator is not injected into MyClass when I take this approach. How can I do this? Interface export abstract class MyClassInterface { abstract connect(); abstract disconnect(); abstract send

How to optimize workflow with single project using Aurelia CLI / ASP.NET Core

那年仲夏 提交于 2019-12-07 05:53:52
问题 I have an ASP.NET Core project, which also hosts an Aurelia CLI project, using TypeScript / SASS. The IDE is Visual Studio 2015. When the project is built by Visual Studio or MSBuild, the au build command is executed in the precompilation target, so when I build or run the ASP.NET Core project from Visual Studio using F5, Aurelia CLI will build and bundle the assets for the Aurelia app into wwwroot as well. This workflow ensures that any solution changes are correctly built, and it also

How to optimize workflow with single project using Aurelia CLI / ASP.NET Core

邮差的信 提交于 2019-12-05 08:48:44
I have an ASP.NET Core project, which also hosts an Aurelia CLI project, using TypeScript / SASS. The IDE is Visual Studio 2015. When the project is built by Visual Studio or MSBuild, the au build command is executed in the precompilation target, so when I build or run the ASP.NET Core project from Visual Studio using F5, Aurelia CLI will build and bundle the assets for the Aurelia app into wwwroot as well. This workflow ensures that any solution changes are correctly built, and it also ensures that .NET Core is running as the web server, however, it's slow for developers, because any changes

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

How can I add Font Awesome to my Aurelia project using npm?

允我心安 提交于 2019-11-27 04:29:05
I have been following the Contact Manager tutorial and would like to add Font Awesome to the project. Here's what I have done so far: npm install Font-Awesome --save Added the following to aurelia.json under the dependencies array of the vendor-bundle.js : ... { "name": "font-awesome", "path": "../node_modules/font-awesome", "resources": [ "css/font-awesome.min.css" ] }, ... But when running au run --watch I get the error: error C:\Users\node_modules\font-awesome.js Why is it looking for the .js file? Don't add font-awesome resources to aurelia.json - you'd need font files too, which Aurelia

How can I add Font Awesome to my Aurelia project using npm?

心不动则不痛 提交于 2019-11-26 11:16:25
问题 I have been following the Contact Manager tutorial and would like to add Font Awesome to the project. Here\'s what I have done so far: npm install Font-Awesome --save Added the following to aurelia.json under the dependencies array of the vendor-bundle.js : ... { \"name\": \"font-awesome\", \"path\": \"../node_modules/font-awesome\", \"resources\": [ \"css/font-awesome.min.css\" ] }, ... But when running au run --watch I get the error: error C:\\Users\\node_modules\\font-awesome.js Why is it