aurelia

Aurelia: configure fetch client

ぃ、小莉子 提交于 2019-12-01 08:00:03
I use Aurelia's fetch client to communicate with my server. In every viewModel using the fetch client I have to configure it the client to use an interceptor to send a custom header(a token). Is there a way to configure the fetch client once somewhere instead of rewriting the interceptor code in each viewModel. You could put the configuration in the main.js file. Like this: ... aurelia.use .standardConfiguration() .developmentLogging(); let container = aurelia.container; let http = new HttpClient(); http.configure(config => { config .useStandardConfiguration() .withBaseUrl('http://localhost

Aurelia if.bind inside repeat.for is not updating

吃可爱长大的小学妹 提交于 2019-12-01 07:34:24
I have a strange case in an Aurelia template of elements with if.bind inside a repeat.for not being shown/hidden when their underlying property is changed. With the following code, the edit fields should be shown and the edit button should be hidden as soon as the edit button is clicked. Subsequently, both the save and undo buttons should hide the edit fields and show the edit buttons again. MyList.ts: import { computedFrom } from "aurelia-binding"; export class MyList { items: any[] = [{ "firstName": "Joe", "lastName" : "Blow", "id": 1 }, { "firstName": "Jane", "lastName" : "Doe", "id": 2 } ]

Aurelia CLI & TypeScript & MomentJS

夙愿已清 提交于 2019-12-01 06:18:52
问题 I'm not getting Aurelia (CLI) & TypeScript & MomentJS to work together. I've seen solutions for Aurelia & Moment problems but they don't use the Aurelia CLI. Here's what I'm doing at the moment: New Aurelia project using Aurelia CLI: au new I select TypeScript instead of Babel. Install moment npm install moment --save This installs Moment 2.4.1. I can find it (including the moment.d.ts) from node_modules. Edit aurelia.json I Add "moment" to "dependencies": Use Moment in app.ts Problems start

Is there a callback or promise for Aurelia show.bind?

你离开我真会死。 提交于 2019-12-01 05:05:35
问题 In my template, I have a div I want to use as a tooltip of sorts. When I have a model selected, the tooltip shows, and then I use tether to put it in the correct spot. If I set tether immediately after setting the model that makes the element show, it's size isn't computed properly and Tether doesn't properly limit constraints. If I debounce it with a setTimeout, I can get it in the right place, but that feels hokey. My question: Is there some sort of callback mechanism I can attach to that

How to use JQuery-UI with Aurelia

只谈情不闲聊 提交于 2019-12-01 04:06:36
I started a new Aurelia app using the Aurelia CLI. I installed JQuery and configured aurelia.json using the instructions at the Aurelia documentation: http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/6 I then npm installed Jquery-ui. I now need to know how to configure audelia.json to recognize jquery-ui. In the Aurelia documentation this example is given on how to reference a module: "dependencies": [ { "name": "library-name", "path": "../node_modules/library-name/dist/library-name" } ] The problem is that unlike when you download jquery-ui directly, the JQuery

Aurelia if.bind inside repeat.for is not updating

雨燕双飞 提交于 2019-12-01 03:08:26
问题 I have a strange case in an Aurelia template of elements with if.bind inside a repeat.for not being shown/hidden when their underlying property is changed. With the following code, the edit fields should be shown and the edit button should be hidden as soon as the edit button is clicked. Subsequently, both the save and undo buttons should hide the edit fields and show the edit buttons again. MyList.ts: import { computedFrom } from "aurelia-binding"; export class MyList { items: any[] = [{

Access a DOM element in Aurelia

前提是你 提交于 2019-12-01 02:08:36
How would you go about accessing a DOM element in Aurelia? This is a broad and general question, but I have a feeling there are one or two preferred ways to do this. I have two current cases in Aurelia now: In the template I have a form. I want to access the form element in the view-model, on VM canDeactivate(), to interrupt a user navigating away from a half filled out form. So the scope in which I'm trying to access the element can be considered local. In another view-model I want to hide navigation on VM activate(). Navigation resides in another view-model/template pair so the scope may be

How to use JQuery-UI with Aurelia

自古美人都是妖i 提交于 2019-12-01 00:57:32
问题 I started a new Aurelia app using the Aurelia CLI. I installed JQuery and configured aurelia.json using the instructions at the Aurelia documentation: http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/6 I then npm installed Jquery-ui. I now need to know how to configure audelia.json to recognize jquery-ui. In the Aurelia documentation this example is given on how to reference a module: "dependencies": [ { "name": "library-name", "path": "../node_modules/library

Using materializecss with aurelia

天大地大妈咪最大 提交于 2019-11-30 23:46:25
I would like to ask if there's a step by step way to use or configure materializecss with Aurelia. I'm currently able to run my Aurelia app up to the point in the tutorials where my index.html looks like this: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <link href="jspm_packages/github/dogfalo/materialize@0.97.0/dist/css/materialize.css" rel="stylesheet" /> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <title></title> </head> <body aurelia-app> <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script> System

Custom element's Binding Context - what is it exactly, how to access parent VM

主宰稳场 提交于 2019-11-30 20:20:39
I couldn't find the answer in the docs, so I'm asking here. What exactly is the binding context passed to the bind method of custom element. Is it simply equal to router's currently active ViewModel ? At least, that's what I've found out so far. Why isn't it the element's parent (in the terms of DOM) VM? with this code @customElement("myelem") @inlineView("<template><content></content></template>") export class MyElem{ bind(ctx){ console.log(ctx); } } // welcome.html <myelem> <h3>inside myelem</h3> <myelem> <h4>inside inside ... </h4> </myelem> </myelem> the output in the console is just