aurelia

Using materialize in aurelia

馋奶兔 提交于 2019-11-29 12:55:21
I have been trying to get the materialize-css framework to work with Aurelia. I am using Typescript with the framework, and running the server on Windows 8 through the cmd with 'gulp watch'. So far I have attempted to use the aurelia-materialize bridge, following the instructions provided. However, after I have followed the steps, I get the following console output using chrome: console error The cmd is clean of errors. These are the contents of the main.ts and index files which are the skeleton-typescript with the materialize bridge on top, without further modification: The image on the left

How to add bindable attributes or any other decorators to a typescript class via decorator?

ぃ、小莉子 提交于 2019-11-29 12:54:13
I want to extend the behavior and data of a class using decorators instead of inheritance. I also want to apply decorators as well to the newly created properties or methods. Is there an example of how to do this? Is this even possible? Imagine a set of classes where some of these classes share a bindable property named span . Also let there be a computed property named leftMargin dependent on the span property. The desired way to implement this would be to decorate the class with a decorator named @addSpan for example, that adds both the bindable property and the computed property to the

Filter array in aurelia view

大兔子大兔子 提交于 2019-11-29 12:00:58
问题 I am using aurelia and want to filter a collection (array) in view rather than in view model. I am trying the following syntax to do so: <div class="col-sm-7 col-md-7 col-lg-7 ${errors.filter(function(err){return err.Key==='car.Model';}).length >0? 'alert alert-danger' :''}"> <span repeat.for="error of errors"> <span if.bind="error.Key==='car.Model'"> ${error.Message} </span> </span> </div> And I am getting following error in browser console: Error: Parser Error: Missing expected ) at column

Fetch API to force download file

柔情痞子 提交于 2019-11-29 11:31:41
I'm calling an API to download excel file from the server using the fetch API but it didn't force the browser to download, below is my header response: HTTP/1.1 200 OK Content-Length: 168667 Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Server: Microsoft-IIS/8.5 Content-Disposition: attachment; filename=test.xlsx Access-Control-Allow-Origin: http://localhost:9000 Access-Control-Allow-Credentials: true Access-Control-Request-Method: POST,GET,PUT,DELETE,OPTIONS Access-Control-Allow-Headers: X-Requested-With,Accept,Content-Type,Origin Persistent-Auth: true X

How to set default activationStrategy in aurelia

若如初见. 提交于 2019-11-29 10:13:48
Aurelia normally ignores any changes in the querystring. It is possible to set the activationStrategy to invoke-lifecycle in the VM so it will re-run the all the life cycles in the VM when the querystring changes. To prevent littering my code (placing it in every VM) i want to set the default activationStrategy to invoke-lifecycle . In the interface it's explained that it is possible, but how to set it? https://github.com/aurelia/router/blob/master/src/interfaces.js On the ViewModel (I misread your question at first too, but I'm leaving this in for completeness) Place a method

Why does the alpha version of Aurelia load slowly?

大憨熊 提交于 2019-11-29 09:19:48
问题 I wrote a minimal test page to try out Aurelia. http://www.andrewgolightly.com/ GitHub: https://github.com/magician11/ag-landingpage My last test, showed it took 55 seconds to load the page with 135 requests. It seems I need to bundle the jspm_packages directory first so that the 543KB gets downloaded at once.. and not in pieces. So given I followed this example: http://aurelia.io/get-started.html How do I bundle the packages? It's not clear to me from https://github.com/jspm/jspm-cli/wiki

Aurelia load routes dynamically / from fetch

☆樱花仙子☆ 提交于 2019-11-29 08:56:32
I want to load menu options dynamically. so I'm wondering the best approach I am able to use the code below to add routes after the page is loaded. This works for normal navigation, but does not work during a refresh. Can configure router return a promise / how do I load menu items into the route? @inject(HttpClient) export class DocumentMenu { router: Router; documents : IDocument[]; heading = 'Document Router'; constructor(public http: HttpClient) {} activate(): void { this.http.fetch('http://localhost:17853/Document/GetDocuments?folderID=13244') .then<IDocument[]>(response => response.json(

Aurelia: During a Router's Pipeline Step, how do I bind a variable to that router?

蓝咒 提交于 2019-11-29 07:20:28
I'd like to pass the user, found during the AuthorizeStep to either the App class and then to the home module . Here's what I have: export class App { configureRouter(config, router) { config.addPipelineStep('authorize', AuthorizeStep); config.map([ {route: ['', ':filter'], name: "", moduleId: 'welcome'} {route: 'home', name: "home", moduleId: 'home' auth:true} ]); this.router = router; } } class AuthorizeStep { run(routingContext, next) { if (routingContext.nextInstructions.some(i => i.config.auth)) { this.client.get('auth/login') .then(response => { this.user = response.content; }); } return

Convert ES6 Class with Symbols to JSON

对着背影说爱祢 提交于 2019-11-29 04:33:23
I have hardcoded classes to represent models in my Aurelia application. Here's a model 'PostEdit': var _postID = Symbol(); var _title = Symbol(); var _text = Symbol(); export class PostEdit { constructor(postEdit) { this[_postID] = postEdit.postID; this.title = postEdit.title; this.text= postEdit.text; } get postID() { return this[_postID]; } get title() { return this[_title]; } set title(val) { this[_title] = val; } get text() { return this[_text]; } set text(val) { this[_text] = val; } } After the object is manipulated, I need to PUT and POST it back to the server. But it looks like Aurelia

Configure Aurelia Project using Visual Studio

落爺英雄遲暮 提交于 2019-11-28 23:42:33
问题 I know it's very new, but I'd like to create a prototype using aurelia with Visual Studio. VS support is in the hopper, but the current documentation is based on node.js et al. Based on the existing documentation, I haven't a clue. I'm hoping I can get some guidance... 回答1: Not sure this is what you are looking for, but you can check out this github Aurelia project, using Typescript and VS 2013. It still makes use of gulp and jspm but with the VS Taskrunner extension. https://github.com