aurelia

Appending a value to the Aurelia router config.title

╄→尐↘猪︶ㄣ 提交于 2019-12-23 10:07:48
问题 I want to set a base title value for my Aurelia application and then append a value to it based on the route that is active. My router configuration is: export class App { configureRouter(config, router) { config.title = 'Brandon Taylor | Web Developer | Graphic Designer'; config.map([ . . . { route: 'work', name: 'work', moduleId: 'work', nav: true, title: ' | work' }, . . . ]); this.router = router; } } Aurelia wants to append the title navigation parameter to the beginning of the config

using multiple translation files in aurelia i18N

蹲街弑〆低调 提交于 2019-12-23 09:56:48
问题 I have a working app using aurelia-i18n. I would like to split translation.json file into multiple files like nav.json, message.json, etc but I am not sure how to do it. This is how it looks right now. locale |-en |- translation.json But I want to change it to this way. locale |-en |- nav.json |- message.json Is it possible to do it? If so, how do I configure it and access values in each file? 回答1: You can have multiple resource files and these are called namespaces in the i18next library (by

Aurelia Custom Elements: Access Parent method

跟風遠走 提交于 2019-12-23 07:05:41
问题 I am using Aurelia's Custom Elements to repeat over a set of entries. Here is the sample gist: https://gist.run/?id=38aee854447122f021bc05e1e0de25ae Now, I need to access the deleteEntry(entry) method when clicked on the button defined in custom element. I tried using $parent.deleteEntry(entry) but it's not working. Saw this issue, but it's more than an year old and I am wondering if there is a cleaner way to achieve this now. 回答1: Why not use the call binding to accomplish this? Here's an

How to: Extend the Aurelia Logger with additional methods

戏子无情 提交于 2019-12-23 05:36:33
问题 Foremost I am following this example on implementing and customizing the aurelia-logger. This approach only works fine. Any changes to the existing methods in the custom appender work fine. However if I change the CustomLogAppender.js to export class CustomLogAppender { constructor(){} debug(logger, message, ...rest){ console.debug(`DEBUG [${logger.id}] ${message}`, ...rest); } info(logger, message, ...rest){ console.info(`INFO [${logger.id}] ${message}`, ...rest); } warn(logger, message, ..

Sheets JavaScript API Uncaught Error

醉酒当歌 提交于 2019-12-23 04:51:35
问题 I'm playing around with the new version of the Google Sheets API in my Aurelia application (I'm using TypeScript). I've managed to login the user and ask for the required scopes but when I'm trying to get the values of a spreadsheet the API throws the following error: cb=gapi.loaded_0:269 Uncaught Error: arrayForEach was called with a non array value(…) This is how I initialize the API and login the user: gapi.load("auth2", () => { gapi.auth2.init({ 'client_id': this.clientId, 'scope': this

Aurelia How do I use a Child Router and dynamics child routes

╄→гoц情女王★ 提交于 2019-12-23 02:58:10
问题 Trying to use a child route in Aurelia. Can't seem to get my head around the workings of nested routes. Are all routes derived from the root of the app or relative to location of the current router? Why wont my route-href work in this example? I have a route in this router named screen and it does have an :id parameter screens/list.ts @inject(Router) export class ScreensList { heading; router; screens: any[]; constructor(router){ this.heading = 'Child Router'; this.router = router; this

Aurelia Dialog and Handling Button Events

跟風遠走 提交于 2019-12-22 17:33:11
问题 I have set up the aurelia-dialog plugin. It's working using the example in the GitHub readme, but the documentation doesn't explain anything about how to use it otherwise. I have a simple use case with a list page. I want to click an "add new" button, pop the modal dialog which has it's own VM. The modal contains a simple dropdown list. I need to select an item on the list and make an API call to save the data, but I can't seem to figure out how to wire up my save method with the save button

Aurelia Dialog and Handling Button Events

霸气de小男生 提交于 2019-12-22 17:33:04
问题 I have set up the aurelia-dialog plugin. It's working using the example in the GitHub readme, but the documentation doesn't explain anything about how to use it otherwise. I have a simple use case with a list page. I want to click an "add new" button, pop the modal dialog which has it's own VM. The modal contains a simple dropdown list. I need to select an item on the list and make an API call to save the data, but I can't seem to figure out how to wire up my save method with the save button

Unit testing logic inside promise callback

Deadly 提交于 2019-12-22 12:23:24
问题 I have an ES6 / Aurelia app that I am using jasmine to test. The method I am trying to test looks something like this: update() { let vm = this; vm.getData() .then((response) => { vm.processData(response); }); } Where this.getData is a function that returns a promise. My spec file looks something like this: describe('my service update function', () => { it('it will call the other functions', () => { myService = new MyService(); spyOn(myService, 'getData').and.callFake(function() { return new

error aurelia-templating-router 1.0.1 with swap-order

不问归期 提交于 2019-12-22 10:48:30
问题 updated aurelia-templating-router for 1.0.1 when I use <router-view swap-order="with"></router/view> An error occurs [app-router] TypeError: Cannot read property 'animatableElement' of undefined If I remove swap-order="with" the error disappears If I use version 1.0.0, even with swap-order="with" , everything works. Someone went through this? I could not play on GistRun, it follows content (Typescript): au new myapp app.ts export class App { router:any; configureRouter(config, router) { this