aurelia

Aurelia: data disappears in table when using DataTables jquery plugin

北城以北 提交于 2019-12-10 12:19:35
问题 I use the jQuery data tables plugin (https://datatables.net/). You can use it on a html table like this: $("#table").DataTable(); If I have a normal html table in my View and call the above in the attached() method of my view model all works fine. But things go wrong when I try to do this when generating the table from data I get from my API. The table gets generated but under it instead of saying something like "showing 0 to 10 of 93 entries" it says "showing 0 to 0 of 0 entries". Also, if I

How to use Aurelia third party plugin with without typescript definition file?

心不动则不痛 提交于 2019-12-10 11:13:54
问题 I am new to Aurelia and Typescript. I am trying to use a the aurelia-dialog plugin inside of my project. I have follow all the necessary steps and am getting an error "cannot find module "aurelia-dialog". The offending line is import {DialogService, DialogController} from "aurelia-dialog"; I am pretty sure all of the config is set up correctly because this is my only error. I have aurelia.use .standardConfiguration() .developmentLogging() .plugin('aurelia-dialog'); Do I need to create a

Aurelia Binding Click Trigger in Nav Bar

左心房为你撑大大i 提交于 2019-12-10 10:27:37
问题 Given the following layout for app.html: <template> <require from="nav-bar.html"></require> <require from="bootstrap/css/bootstrap.css"></require> <nav-bar router.bind="router"></nav-bar> <div id="sidebar"><h3>This is the sidebar.</h3></div> <div id="page-host" class="page-host"> <router-view></router-view> </div> </template> How do I bind to the toggleSidebar function (which is exported from app.js) in nav-bar.html? <template bindable="router"> <nav class="navbar navbar-default navbar-fixed

Aurelia.io: how to navigate to route

前提是你 提交于 2019-12-10 10:15:25
问题 I have a router.js file with my configured routes: routes.js export class App { configureRouter(config, router) { config.title = 'Aurelia'; config.map([ {route: ['', `welcome`], name: 'welcome', moduleId: './welcome', nav: true, title:'Welcome'}, {route: 'http', name: 'http', moduleId: './http', nav: true, title:'HTTPTest'}, {route: 'users', name: 'users', moduleId: './users', nav: true, title:'Github Users'}, {route: 'plan', name: 'plan', moduleId:'./dp/plan', nav: true, title:'DPTest'},

Generate a raw HTML string from a component file and a view model

断了今生、忘了曾经 提交于 2019-12-10 04:24:45
问题 We have a template like this. the-template.html <template><div>${Foo}</div></template> We want to do this with it. some-file.ts let htmlString = makeItHappen('the-template.html', { Foo = 'bar' }); console.info(htmlString); // <div>bar</div> What is the equivalent of our makeItHappen function? 回答1: Ok so here's the gist: https://gist.run/?id=d57489d279b69090fb20938bce614d3a Here's the code in case that goes missing (with comments): import {bindable} from 'aurelia-framework'; import

Aurelia CLI include Bootstrap Glyphicons

蹲街弑〆低调 提交于 2019-12-10 02:59:02
问题 I'm trying to include Bootstrap in my Aurelia CLI project, and the CSS and JS work fine. The only problem I have is the glyphicons require font files to be loaded. I use this configuration: "dependencies": [ { "name": "bootstrap", "path": "../node_modules/bootstrap/dist", "main": "js/bootstrap.min", "deps": ["jquery"], "exports": "$", "resources": [ "css/bootstrap.min.css", "fonts/glyphicons-halflings-regular.woff2" ] } ] But I get an error containing this line: path: 'C:\Users\randy

Aurelia DI with typescript interfaces

半腔热情 提交于 2019-12-10 01:30:02
问题 I've gone through the documentation of Aurelia DI and looked at the source code and wanted to share what I'm trying to achieve so that I can be shot down if I'm missing something obvious. I've looked at the samples here for TS with Aurelia but I can't see how it will work, and the docs are lacking. What I want is: dataProvider.js (the data provider interface) export interface DataProvider { getData(): number; } itemDisplayer1.js (a class that will consume an injected class that implements the

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

时光怂恿深爱的人放手 提交于 2019-12-10 01:09:59
问题 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"

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

这一生的挚爱 提交于 2019-12-09 23:25:54
问题 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. 回答1: 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

Control value of input in Aurelia

前提是你 提交于 2019-12-09 19:25:42
问题 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