aurelia

Bootstrap 4 error “Bootstrap dropdown require Popper.js”, with Aurelia CLI and Require.js

∥☆過路亽.° 提交于 2019-12-04 23:57:50
I'm having trouble configuring Bootstrap 4 beta in an Aurelia CLI app (v0.31.1) with requirejs and using TypeScript. After having tried several config variations I keep on getting the following console error: Uncaught Error: Bootstrap dropdown require Popper.js Here are the steps to reproduce. First, install the packages: $ npm install --save jquery bootstrap@4.0.0-beta popper.js Next, I've configured aurelia.json : "jquery", { "name": "popper.js", "path": "../node_modules/popper.js/dist/umd", "main": "popper" }, { "name": "bootstrap", "path": "../node_modules/bootstrap/dist", "main": "js

Getting the current route in Aurelia

陌路散爱 提交于 2019-12-04 22:58:42
To get the current route within a non-view-model class, would the best practice be to inject the Router and use this.router.history.fragment? Or is this a no-no? You could inject the router and get the current instruction. Like this: import { inject } from 'aurelia-dependency-injection'; //or framework import { Router } from 'aurelia-router'; @inject(Router) export class MyClass { constructor(router) { this.router = router; } getRoute() { return this.router.currentInstruction.config.name; //name of the route //return this.router.currentInstruction.config.moduleId; //moduleId of the route } }

How do I use a router and inbuilt/custom attributes to create dropdown menu in aurelia?

坚强是说给别人听的谎言 提交于 2019-12-04 18:54:50
Twitter bootstrap has a dropdown menu option; where a menu has have multiple layers. See: http://getbootstrap.com/javascript/#dropdowns How can I use Aurelia.js's routers to recreate this? Routers normally provide 1 level. I need 2 levels. Credit for this goes to: https://github.com/adarshpastakia . I "borrowed" most of this person's code to answer this question. You can find it at: https://gist.github.com/adarshpastakia/5d8462b5bc8d958d5cb3 Here are steps to answer the question above: (1) In the router, add a "settings" property. It can be whatever you want. Here is an example: settings:{

Access an element's Binding

断了今生、忘了曾经 提交于 2019-12-04 18:25:01
I have a custom attribute that processes authentication data and does some fun stuff based on the instructions. <div auth="disabled: abc; show: xyz; highlight: 123"> There's a lot of complicated, delicate stuff happening in here and it makes sense to keep it separate from semantic bindings like disabled.bind . However, some elements will have application-logic level bindings as well. <div auth="disabled.bind: canEdit" disabled.bind="!editing"> Under the covers, my auth attribute looks at the logged in user, determines if the user has the correct permissions, and takes the correct action based

Aurelia starting with params passed by PHP

南笙酒味 提交于 2019-12-04 17:39:24
I need to pas params to Aurelia on start. Depending on values passed the application will have diffrent state. This application is injected on page which is build with PHP, so the best way would be starting it with parameters specified with PHP code. Is there any way to do this? Any data you can access in normal JS you can access with Aurelia. Maybe you could use a data-* attribute to do this? When you use a main file by doing aurelia-app="main", the framework instance you get passed to your configure method has a host property that is the element the framework is being attached to. You could

Deploying an aurelia.cli built app

被刻印的时光 ゝ 提交于 2019-12-04 17:17:31
问题 I have built a simple aurelia web page without a back end, and I am now interested in going into production. I used Aurelia-cli for bundling, hoping this would be simple, but I am not sure how to proceed. Which files should I upload to the server to have the site working? Thanks for the help. 回答1: In a nutshell: au build --env prod copy the index.html to your main deployment folder on your server copy the /scripts folder to the same location. 回答2: we created a deployment script that: runs the

Difference between a Component and a View in Aurelia (and their lifecycles)

拟墨画扇 提交于 2019-12-04 14:23:17
Could you please tell me what is difference between a component and a View in Aurelia? What are their architectures and What is the difference between their lifecycles? As a rule of thumb, the difference between a view and a component in Aurelia can be summarised as: A view in Aurelia is simply put the .html and the styling that comes with it (.scss/.less/.css) A view-model in Aurelia is the code behind it (.js/.ts class) A component is the combination between a view and view-model, and is glued together automagically by Aurelia In essence you can say that, with Aurelia, pretty much everything

Control value of input in Aurelia

試著忘記壹切 提交于 2019-12-04 14:06:43
I need to create an input in Aurelia that only accepts a phone number. If the user types 1234567890 into this input it should display (123) 456-7890 and the bound variable would be set to 1234567890 . The result should be the same if the user types (123) 456-7890 into the input as well. If the user types a letter into the input, the input should not display the letter, nor should the bound javascript variable get updated. I'm able to partially achieve this using a ValueConverter: phone.ts export class PhoneValueConverter { private removeNonDigits(input) { let digits = ''; // Remove non-digits.

Using SASS with Aurelia's Skeleton Navigation project

谁都会走 提交于 2019-12-04 12:36:52
问题 var gulp = require('gulp'); var sass = require('gulp-sass'); var runSequence = require('run-sequence'); var changed = require('gulp-changed'); var plumber = require('gulp-plumber'); var to5 = require('gulp-babel'); var sourcemaps = require('gulp-sourcemaps'); var paths = require('../paths'); var compilerOptions = require('../babel-options'); var assign = Object.assign || require('object.assign'); // transpiles changed es6 files to SystemJS format // the plumber() call prevents 'pipe breaking'

How to deploy Aurelia to GitHub Pages (gh-pages)

[亡魂溺海] 提交于 2019-12-04 12:06:09
问题 I haven't seen demos of Aurelia running in GitHub pages. I wonder if there's a gist or a repo somewhere that shows how it can be done. Is it just a matter of configuring gulp or is there another solution? 回答1: Here is the solution using the Aurelia navigation skeleton project as an example when created into your organization as a repository as aurelia-skeleton-navigation . Important Note: This is NOT a production solution. This is for showing how to run Aurelia within GitHub pages using an