aurelia

Aurelia get value conventer results in view

随声附和 提交于 2019-12-03 11:54:39
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 filteredItems = (items | filter:keyword)" or here : ng-repeat="item in items | filter:keyword as

Using SASS with Aurelia's Skeleton Navigation project

馋奶兔 提交于 2019-12-03 08:14:18
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' caused // by errors from other gulp plugins // https://www.npmjs.com/package/gulp-plumber gulp.task(

TypeScript class decorator that modifies object instance

邮差的信 提交于 2019-12-03 06:46:23
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.prototype = Object.create(original.prototype); newConstructor.prototype.constructor = original; return

Aurelia: Isomorphic?

跟風遠走 提交于 2019-12-03 06:44:30
As far as I know, Aurelia does not support server-side rendering as mentioned here . But the question is: is it possible to do this with some hacks/workarounds? The most obvious idea would be to use Phantom, Nightmare.js or whatever to simply render that page in Chrome on server and serve that to client, but this is very likely to cause big productivity issues. Thanks! UPD According to Rob Eisenberg's response on FDConf today (16 Apr 2016), server-side rendering will be implemented in 2016, there's one core team member working on that and there's a deadline for this feature. There is an open

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

别说谁变了你拦得住时间么 提交于 2019-12-03 06:43:57
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? 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 Aurelia repository that uses Gulp . It is recommended to read about jspm bundling an Aurelia app for

How to force binding re-evaluate or re-rendering in Aurelia

大兔子大兔子 提交于 2019-12-03 05:59:13
I am starting with a simple TODO app with Aurelia, RethinkDB & Socket.IO. I seem to have problem with re-rendering or re-evaluating an object that is changed through Socket.IO. So basically, everything works good on the first browser but doesn't get re-rendered in the second browser while displaying the object in the console does show differences in my object. The problem is only on updating an object, it works perfectly on creating/deleting object from the array of todo items. HTML <ul> <li repeat.for="item of items"> <div show.bind="!item.isEditing"> <input type="checkbox" checked.two-way=

Error handling for fetch() in Aurelia

不羁岁月 提交于 2019-12-03 05:54:34
问题 I have an API that includes a useful description of what went wrong when an error is raised by the server (status = 500). The description comes as part of the response text. My client code, using Aurelia, calls the api via aurelia-fetch-client using a generic method to make the call: function callRemoteService(apiName, timeout) { return Promise.race([ this.http.fetch(apiName), this.waitForServer(timeout || 5000) // throws after x ms ]) .then(response => response.json() ) .catch(err => { if

Aurelia repeat.for access index of item

吃可爱长大的小学妹 提交于 2019-12-03 04:09:33
I have a simple repeat.for: <li repeat.for="item of items">${item}</li> Currently I'm using: ${$parent.items.indexOf(item)} . Is there a shorthand, something like {{$index}} in angular? There is. Write this: <li repeat.for="item of items">${$index} - ${item}</li> 来源: https://stackoverflow.com/questions/28418345/aurelia-repeat-for-access-index-of-item

How to access child router in Aurelia?

戏子无情 提交于 2019-12-03 04:00:42
I have two child routers. I can navigate from one to other. But from the child router view, how can I navigate? Below line of code gives the parent router instance. import {Router} from 'aurelia-router' How to get child router instance? To create a child router, create a new router on a child route in the same way you created a router on the parent route. Then, set the router as a property of the view model class so you can access it throughout your view model. import { Router } from 'aurelia-router'; class ChildViewModel() { configureRouter(config, router) { this.router = router; // router

Using a Decorator to get list of implemented interfaces

落爺英雄遲暮 提交于 2019-12-03 02:53:58
Do you know if it is possible to get the array of interfaces implemented by a class using a decorator: interface IWarrior { // ... } interface INinja { // ... } So If I do something like: @somedecorator class Ninja implements INinja, IWarrior { // ... } At run-time Ninja will have an annotation which contains ["INinja", "IWarrior"] ? Thanks Currently, types are used only during development and compile time. The type information is not translated in any way to the compiled JavaScript code. But you however can pass the list of strings to the decorator parameter like this: interface IWarrior { //