aurelia

How to require('electron') when script is loaded by system.js

拈花ヽ惹草 提交于 2019-12-07 22:25:12
问题 I'm trying to use Aurelia and SystemJs within an electron app; I have a fairly basic app-window.js : const remote = require('electron').remote; document.getElementById("close-btn").addEventListener("click", function (e) { var window = remote.getCurrentWindow(); window.close(); }); ... if I consume it as normal html script ( <script src="app-window.js"></script> ) it works perfectly fine. However, if I have systemJS import it: <script> System.import('app-window.js'); </script> I get the error:

Redirect within MapUnknownRoutes in Aurelia

北城以北 提交于 2019-12-07 16:45:43
问题 I want bad routes to navigate to the root route. I've added a mapUnknownRoutes configuration on my router. config.mapUnknownRoutes((inst) => inst.config.moduleId = 'home'); But this leaves the route untouched. For example, #/fakeRoute routes to home. Ideally, I would like a behavior similar to returning { redirect: '#/' } , which cancels navigation and creates a new navigation to the route '#/' . Is this a feature? 回答1: The mapUnknownRoutes method also accepts a RouteConfig object so you can

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

Aurelia Validation - no message shown on failed validation

雨燕双飞 提交于 2019-12-07 13:51:29
问题 I've been working through the Aurelia-Validation example, and I have the following: index.html <!doctype html> <html> <head> <title>Aurelia</title> <link rel="stylesheet"href="styles/styles.css"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body aurelia-app="main"> <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script> System.import('aurelia-bootstrapper'); </script> </body> </html> welcome.js import {Validation} from

Aurelia: Trigger Validation on tab-out(blur event)

爷,独闯天下 提交于 2019-12-07 12:43:43
问题 I have returned a validation group to validate my inputs which triggers on submit button and I want to trigger by validation on blur event to trigger respective validation, not all. For example: HTML: <form role="form" submit.delegate="welcome()" validate.bind="validation"> <div class="form-group"> <label for="fn">First Name</label> <input type="text" value.bind="firstName & updateTrigger:'blur'" class="form-control" id="fn" placeholder="first name" /> <span>${firstName}</span> </div> <button

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

Is it possible to use Aurelia in a non-spa application?

荒凉一梦 提交于 2019-12-07 07:11:39
问题 Recently I've been playing around with different frameworks and libraries, looking for something that really suits my needs. You see, my job mainly involves creating asp.net mvc applications and for most of them using Razor and a little bit of jQuery is enough. But in certain cases and only for a few pages,which are rarely more than one or two per app, I really need something extra that helps me avoid getting entangled in a bunch of jQuery code. As I mentioned, I tried a couple of

Angular to Aurelia Transition - Some basic questions

半腔热情 提交于 2019-12-07 06:04:06
问题 We are thinking about using Aurelia for a new app. I come from an Angular 1 background (with some exposure to Angular 2). Aurelia seems quite nice and I really like how they have taken on the responsibility of maintaining developer workflow. However I have some questions which I cannot seem to find the answers to: 1) There are two general ways (as I understand) that one can include a web component in a page. These are <compose> and write a custom element. My question is, coming from Angular

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 can I get the Amazon Cognito Identity SDK working in Aurelia?

岁酱吖の 提交于 2019-12-06 23:43:22
问题 I am trying to get the Amazon Cognito Identity SDK working in Aurelia. I do not have a lot of Javascript experience and am very unfamiliar with the various dependency systems. I installed the Cognito SDK using: npm install --save amazon-cognito-identity-js I then edited my aurelia_project/aurelia.json file as suggested in the Aurelia documentation to include a new client library dependency in build.bundles vendor-bundle dependencies: "sjcl", "jsbn", { "name": "aws-sdk", "path": "../node