aurelia

Aurelia - Inline definition of HTML-only custom element

ぃ、小莉子 提交于 2019-12-09 15:52:00
问题 I have a recursive object in my Aurelia view model that looks like this: Class BottomlessPit { Name: string = ''; MorePits: BottomlessPit[] = null; } Therefore, I'd like to use a recursive template in my Aurelia view. It will only be used in one place, so I would rather use a template literal. Here's some pseudocode that doesn't work: <template name="pit"> <li> ${Name} <compose view.bind="pit" repeat.for="subpit of MorePits"></compose> </li> </template> Is this a feature of Aurelia? 回答1: OK

Aurelia: child router routes display in “main” nav-bar and child view in app.html <router-view> element?

ぐ巨炮叔叔 提交于 2019-12-09 13:16:20
问题 We want to have a sidebar menu and a "main" area. Depending on how you navigate, the sidebar's menu items will change, and a new view will be loaded into the "main" area. I've created app.html with a <router-view> element, and a nav-bar.html that can display the main router's navigation. Let's say that I initially have "Administration" and "Reports" as routes (and therefore menu items). When a user clicks on "Administration", I'd like the menu to update to display child routes (say "Users"

Aurelia get value conventer results in view

泄露秘密 提交于 2019-12-09 09:20:46
问题 I would like to get the result of value conventer that filters an array in my view in order to display the number of results found. <div repeat.for="d of documents|docfilter:query:categories"> <doc-template d.bind="d"></doc-template> </div> I neither want to move this logic to my controller (to keep it clean), nor to add crutches like returning some data from the value controller. What I want: So, basically I would like something like angular offers: Like shown here: ng-repeat="item in

Including bootstrap css in Aurelia

萝らか妹 提交于 2019-12-09 09:10:47
问题 I am new to Aurelia and falling at the first hurdle. I have created a new project using the aurelia cli and have selected to use less. This works fine until I try to use bootstrap. I have installed bootstrap with npm which appears in node_modules/bootstrap/ This has the directory structure dist fonts grunt Gruntfile.js js less LICENSE package.json README.md There are css files in the dist directory. In my template I do The error I get is Unhandled rejection Error: Failed loading required CSS

Importing CSS and controlling order in <head> using jspm and system.js

假如想象 提交于 2019-12-09 05:42:39
问题 I've written the following in an Aurelia app import "bootstrap/css/bootstrap.css!"; import "./app.css!"; and I want app.css second in since it overrides bootstrap.css styles. However, I'm getting app.css first since I presume the system.js loader is running them in parallel and since app.css is the smaller of the two it gets loaded first. Is there a way in jspm to define a dependency between these two files to control their loading order is is there some other way? Many thanks in advance! :)

TypeScript class decorator that modifies object instance

感情迁移 提交于 2019-12-09 05:39:48
问题 I'm making a plugin for Aurelia and need a class decorator that adds attributes to the new object instance, and calls an external function with the new object as an argument. I've looked through examples, and so far I've put together ("pseudo-ish" code) return function addAndCall(target: any): any { var original = target; var newConstructor = function (...args) { original.apply(this, args); this.newAttribute = "object instance value"; ExternalModule.externalFunction(this); }; newConstructor

Client side cache busting using the CLI

一曲冷凌霜 提交于 2019-12-09 00:01:35
问题 We're using the aurelia-cli . The tasks include these: build.json build.ts process-css.ts process-markup.ts process-sass.ts run.json run.ts test.json test.ts transpile.ts How if at all do we do a cache-busting solution the with cli? What we've tried already is to increment the number of the scripts directory, so that it goes scripts1 , scripts2 , scriptsN . 回答1: 0.20.0 Support It's my lucky day. An aurelia-cli release from 8 hours ago says this: Features: Support bundle revision numbers

Angular Service in Aurelia?

萝らか妹 提交于 2019-12-08 22:01:00
问题 I've yet to find decent documentation detailing how to migrate from Angular 1.x to Aurelia. So far, I've only seen folks detailing how the concept of an Angular directive can be remade in Aurelia using @customElement . Okay, simple enough. But these examples always, always just mock data. That said, Angular Services are singletons that can be injected into any controller/directive/service, and typically allows for the fetching of data from a server (i.e. PersonService , OrdersService ). But

How to set up a checkbox binding in Aurelia

a 夏天 提交于 2019-12-08 15:46:59
问题 I have a checkbox list, when the user checks one of the checkbox a function is called in the .js file and it in turn calls a method dataservice.js which calls a webapi controller, this all works fine and returns the correct data. What happens when the process is finished is that the checkbox that fired the sequence isn't checked. I've inspected the result and schoolDistrict.IsChecked for that item is set to true, which is correct. How do I get the checkbox to be checked? Below is the code,

Change Array Order in Aurelia, weird behaviour

孤街浪徒 提交于 2019-12-08 10:42:50
问题 I am trying to build a custom element to manage simple lists, renaming the items and changing their order. Unfortunately I'm noticing some weird behavior that's actually really hard to pin down. Typing into the inputs does not appear to be recognized as changes for Aurelia to update the item When typing/changing one item after page load and then changing its position in array via those methods, the index of the item seems lost (turns into -1). If the item isn't changed via input field, the