aurelia

Global Application State in Aurelia

坚强是说给别人听的谎言 提交于 2019-12-10 17:43:20
问题 I'm trying to inject a class to other places in my Aurelia app to share authentication state after login. I'm following this example http://hobbit-on-aurelia.net/appstate/ but it looks like the scope is lost during transitions or they are independent instances. Aurelia's docs says: By default, the DI container assumes that everything is a singleton instance; When I set the router doing this.userSession.router = router from app instance, the userSession instance is not updated. this.loggedUser

After bundling my aurelia app I get a: No PLATFORM.Loader error

前提是你 提交于 2019-12-10 17:14:44
问题 After bundling a simple aurelia application with jspm bundle-sfx I get the following error: No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app. An example application: https://github.com/Baudin999/jspm-bundling-test You can use: npm run setup:dev in a non windows env to switch back to the dev settings (which is just a comment/uncomment in the ./src/client/index.html) and you can use npm run setup:prod to switch back

How to load an Aurelia plugin in Karma

南笙酒味 提交于 2019-12-10 17:04:07
问题 I've this ViewModel which is a login confirmation page viewmodel: src/pages/confirm.ts import { autoinject } from 'aurelia-framework'; import { Router, NavigationInstruction } from 'aurelia-router'; import { ValidationControllerFactory, ValidationController, ValidationRules } from 'aurelia-validation'; import { LoginService } from '../services/login.service'; import { Settings } from '../config/settings'; import { State } from '../services/state'; import { Helpers } from '../services/helpers'

aurelia-fetch-client create request headers on the fly

只谈情不闲聊 提交于 2019-12-10 16:44:28
问题 I am using aurelia-fetch-client to send some data to a web-api (in a register method). headers: Headers; register() { this.headers = new Headers(); this.headers.append("content-type", "application/json; charset=utf-8"); this.httpClient.fetch("api/Account/Register", { method: "POST", body: JSON.stringify({ email: this.email, password: this.password }), headers: this.headers }) } As you see, I want to update the headers of my request (in that append method call) and for doing that I need to

Aurelia attached triggers before repeat.for

戏子无情 提交于 2019-12-10 15:59:49
问题 I'm trying to setup certain logic in Aurelia that would affect DOM nodes looped by repeat.for. If I understand the documentation correctly, the attached() callback of the view is called after DOM rendering and is the place put this kind of logic in. The problem is that the attached() callback seems to be fired before the repeat.for binding is complete, leaving me with only a partially rendered dom. In order to illustrate the problem: I have a custom element containing: <template> <ul> <li

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

Binding properties from view-model to custom element in Aurelia

余生长醉 提交于 2019-12-10 14:02:54
问题 UPDATE: Other people have reported this sample works well for them. Sounds like I was doing something wrong but I don't have the code anymore so I can't check what was the problem. ORIGINAL QUESTION: I have the following custom element with the following view-model and view: import {bindable} from 'aurelia-framework'; export class Test1 { @bindable name = null; } <template> <div>Name: ${name}</div> </template> Then I have a this view and view-model using the above custom element (this is the

gulp command giving errors of modules can not find

泄露秘密 提交于 2019-12-10 13:46:20
问题 I am trying to set up the basic aurelia app on windows. I have followed instructions from: http://aurelia.io/get-started.html, which includes: Installed node js Installed the gulp using: npm install -g gulp Installed jspn by using: npm install -g jspm Then downloaded the sample source code from https://github.com/aurelia/skeleton-navigation/releases to the project folder. Opened a console and changed to project directory ie. navigation-app Executed the command : npm install Executed the

Using literal JavaScript values in an Aurelia view

若如初见. 提交于 2019-12-10 13:07:27
问题 I'm trying to make my component hidable by using "if" Template Controller. The problem is that it's visible even if I put false in it: <template if.bind="${false}"> zzzzzzzz </template> if.bind="false" and both cases without bind bring same result. Am I doing something wrong? If not, could you please point to aurelia code debugging which may help me to get a clue? Best regards, Eugene. 回答1: Interpolation Using if.bind signals Aurelia to try to evaluate the expression. Therefore, you don't

Aurelia: self-closing require element does not work

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 12:46:48
问题 Why can't Aurelia deal with self-closing require elements? For example: <require from="component"></require> works <require from="component"/> doesn't work No error is given, yet the entire template will fail if you try to use the self-closing element. 回答1: According to the HTML specification, there are just a few void elements (elements that only have a start tag), which are: area , base , br , col , embed , hr , img , input , keygen , link , meta , param , source , track , wbr . https://www