by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 01 11:41
    CLAassistant commented #687
  • Aug 01 11:41
    dependabot[bot] labeled #687
  • Aug 01 11:41
    dependabot[bot] opened #687
  • Aug 01 11:41

    dependabot[bot] on npm_and_yarn

    chore(deps): bump elliptic from… (compare)

  • Aug 01 04:48
    CLAassistant commented #320
  • Aug 01 04:48
    dependabot[bot] labeled #320
  • Aug 01 04:48
    dependabot[bot] opened #320
  • Aug 01 04:48

    dependabot[bot] on npm_and_yarn

    chore(deps): bump elliptic from… (compare)

  • Jul 31 13:55
    CLAassistant commented #137
  • Jul 31 13:55
    dependabot[bot] labeled #137
  • Jul 31 13:55
    dependabot[bot] opened #137
  • Jul 31 13:55

    dependabot[bot] on npm_and_yarn

    chore(deps): bump elliptic from… (compare)

  • Jul 31 12:37
    CLAassistant commented #395
  • Jul 31 12:37
    dependabot[bot] labeled #395
  • Jul 31 12:37
    dependabot[bot] opened #395
  • Jul 31 12:37

    dependabot[bot] on npm_and_yarn

    chore(deps): bump elliptic from… (compare)

  • Jul 30 15:08
    CLAassistant commented #23
  • Jul 30 15:08
    dependabot[bot] labeled #23
  • Jul 30 15:08
    dependabot[bot] opened #23
  • Jul 30 15:08

    dependabot[bot] on npm_and_yarn

    build(deps): bump elliptic from… (compare)

Alfred Lopez
@alfredlopez

Quick question…

if I have something like

@connectTo<State>( {
     selector: {
           myStateVar: ….
     }
})

Do I still have to create the property myStateVar? I’ve been applying the @ts-ignore everywhere I have this.myStateVar.

bigopon
@bigopon
@alfredlopez you don't have to. But it doesn't really hurt to declare it for the purpose of documentation and readability/maintainability
a simple comment where its value comes from should be awesome for the next time someone reads it
Corneliu
@corneliutusnea

Guys, is there an event in my MV where I know for sure that the child view-models are already created? E.g. I have this view:

<template>
<child view-model.ref="childView"></child>
</template>

Now I find myself in the parent view in various events (e.g. bind, activated or attached) in which the this.childView is always null. If I set a timeout and check at some point in the future I can see it's created and available but I can't find any predictability to when that will be available. Thoughts?

Keith Davidson
@davidsk
Hi all. Would I be correct in thinking that there's no way to bind to an array element by index? Something like:
//viewModel
class myClass{
   myArray: ['A','B','C']
}

// view
<template>
   <input value.bind="myArray[1]" />
   ${myArray[1]}
</template>
Alfred Lopez
@alfredlopez
Thanks @bigopon
bigopon
@bigopon
@kensign not in v1, as Aurelia in v1 doesnt observe index. Though it can be made to work. Maybe create a topic on discourse or a feature request on github?
Keith Davidson
@davidsk
@bigopon I assume you're referencing my question about arrays and indexing. I did eventually find some info on using the mutator methods to manipulate the array which seems to work okay. This doesn't seem to be documented in the docs though :'(
bigopon
@bigopon
Yeah, we have some minor hiccups like this in the doc
Well I should learn to incorporate complains into doc
@corneliutusnea if you declared childView as @observable, then you can react to childView readiness in childViewChanged?
Khuzema Kanore
@khuzemakanore

Hello guys, I have below statement (using typescript)

      getAllUsers(): UserProfile {
      return this._httpClient.fetch(Constants.apiRoot + 'Account/Users');
    }

The above statement is giving error. How should I construct the above statement so its satisfy the typescript requirement for typecasting the UserProfile as a return result. Thanks

bigopon
@bigopon
@khuzemakanore you can do:
getAllUsers(): UserProfile {
  return this._httpClient.fetch(Constants.apiRoot + 'Account/Users').then(r => r.json());
}
rhys
@rhysshadow

i am trying to run a new app i'm working on, and i've got the following error:

aurelia-logging-console.js?dc89:45 ERROR [app-router] Error: Route not found: /
at AppRouter.Router._createNavigationInstruction (aurelia-router.js?e32b:957)
at AppRouter.loadUrl (aurelia-router.js?e32b:2020)
at BrowserHistory._loadUrl (aurelia-history-browser.js?d627:262)
at BrowserHistory.activate (aurelia-history-browser.js?d627:156)
at AppRouter.activate (aurelia-router.js?e32b:2091)
at AppRouter.registerViewPort (aurelia-router.js?e32b:2068)
at new RouterView (aurelia-templating-router.js?ab30:59)
at Object.invoke (aurelia-dependency-injection.js?dd4f:384)
at InvocationHandler.invoke (aurelia-dependency-injection.js?dd4f:357)
at Container.invoke (aurelia-dependency-injection.js?dd4f:543)
error @ aurelia-logging-console.js?dc89:45
eval @ aurelia-logging.js?30fd:38
eval @ aurelia-router.js?e32b:2023
Promise.catch (async)
AppRouter.loadUrl @ aurelia-router.js?e32b:2022
BrowserHistory._loadUrl @ aurelia-history-browser.js?d627:262
BrowserHistory.activate @ aurelia-history-browser.js?d627:156
AppRouter.activate @ aurelia-router.js?e32b:2091
AppRouter.registerViewPort @ aurelia-router.js?e32b:2068
RouterView @ aurelia-templating-router.js?ab30:59
invoke @ aurelia-dependency-injection.js?dd4f:384
InvocationHandler.invoke @ aurelia-dependency-injection.js?dd4f:357
Container.invoke @ aurelia-dependency-injection.js?dd4f:543
get @ aurelia-templating.js?8628:2281
Container.get @ aurelia-dependency-injection.js?dd4f:498
elementContainerGet @ aurelia-templating.js?8628:2336
create @ aurelia-templating.js?8628:4362
applyInstructions @ aurelia-templating.js?8628:2446
create @ aurelia-templating.js?8628:2667
create @ aurelia-templating.js?8628:4374
eval @ aurelia-templating.js?8628:4870
Promise.then (async)
createController @ aurelia-templating.js?8628:4869
_createControllerAndSwap @ aurelia-templating.js?8628:4828
compose @ aurelia-templating.js?8628:4930
compose @ aurelia-templating.js?8628:5196
setRoot @ aurelia-framework.js?0682:113
eval @ main.js?56d7:66
Promise.then (async)
configure @ main.js?56d7:55
eval @ aurelia-bootstrapper.js?6fd9:128
Promise.then (async)
config @ aurelia-bootstrapper.js?6fd9:123
eval @ aurelia-bootstrapper.js?6fd9:159
Promise.then (async)
bootstrap @ aurelia-bootstrapper.js?6fd9:158
eval @ aurelia-bootstrapper.js?6fd9:145
Promise.then (async)
run @ aurelia-bootstrapper.js?6fd9:140
eval @ aurelia-bootstrapper.js?6fd9:165
eval @ b9nV:143
b9nV @ vendors~0ba1d959.2232acfea14b69620719.chunk.js:23
webpack_require @ runtime~app.2232acfea14b69620719.bundle.js:80
0 @ app~f075b844.2232acfea14b69620719.chunk.js:13
webpack_require @ runtime~app.2232acfea14b69620719.bundle.js:80
checkDeferredModules @ runtime~app.2232acfea14b69620719.bundle.js:46
webpackJsonpCallback @ runtime~app.2232acfea14b69620719.bundle.js:33
(anonymous) @ app~f075b844.2232acfea14b69620719.chunk.js:1
aurelia-logging-console.js?dc89:45 ERROR [app-router] Router navigation failed, and no previous location or fallbackRoute could be restored.

code from app.js

import {PLATFORM} from 'aurelia-framework';

export class App {
  configureRouter( config, router )
  {
    config.title = 'ARIS';
    config.options.pushState = true;
    config.options.root = '/';

    config.map([
      {route: '', moduleId: PLATFORM.moduleName('home'), nav: true, title: 'home'},
      {route: 'search', moduleId: PLATFORM.moduleName('search'), nav: true, 
        title: 'Search/Worklist'},
    ]);

    config.fallbackRoute('/');

    this.router = router;
  }
}
WisdomCorp
@WisdomCorp
Hello, what is the Aurelia generator command for creating simple html and ts file? like for element you have
au generate element newelement
bigopon
@bigopon
@rhysshadow the API is config.mapUnknownRoutes instead of fallbackRoute
for your Q, the string you pass to mapUnknownRoutes is the path to the view model you want to use, not a redirect URL
@WisdomCorp you meant create a pair, but not for an element?
WisdomCorp
@WisdomCorp
yes
It will be similiar as element but generate in current directory with basic structure for html ie: <template> ${Your template} </template>) and for ts file ie: export class className { }. Hope I am clear :)
bigopon
@bigopon
well ... maybe put a request in our cli repo? That feature is not there, afaik :smile:
probably everyone was fine with doing it manually
WisdomCorp
@WisdomCorp
Not an issue. Just think of it when there are all other generators available this one should be the first to be there ;)
thanks
bigopon
@bigopon
no worries :smile:
and, if you can, have fun here https://discourse.aurelia.io and here https://discord.gg/RBtyM6u
we are trying to migrate our community there
discourse for Q/A topics & discord for quick chat
WisdomCorp
@WisdomCorp
what is the error object return by aurelia-fetch-client. I will use discord
bigopon
@bigopon
for fetch client, you get a response, and it could depends on what you do with it (rethrow a normalized error object), you get a different thing
WisdomCorp
@WisdomCorp
I mean you get something similar
import { HttpErrorResponse } from "@angular/common/http";
bigopon
@bigopon
@WisdomCorp not out of the box. Thought you can easily do similar thing with our interceptor. Simply intercept response error and process it the way you like
WisdomCorp
@WisdomCorp
Any pointer to code sample or doc
scroll down a bit to the with interceptors section
WisdomCorp
@WisdomCorp
Thanks
bigopon
@bigopon
no worries :smile:
night
rhys
@rhysshadow

@bigopon I am still getting the error, even when I change to config.mapUnknownRoutes

I am unsure where the reference to '/' is being found at, as that seems what I need to fix?

bigopon
@bigopon
yes, you need to replace / with a module name, pointing to the view model you want to use to display when route not found happens
rhys
@rhysshadow

here is what i have now:

```export class App {
configureRouter( config, router )
{
config.title = 'ARIS';
config.options.pushState = true;
config.options.root = 'home';

config.map([
  {route: '', name: 'home', moduleId: PLATFORM.moduleName('home'), nav: true, title: 'home'},
  {route: 'search', moduleId: PLATFORM.moduleName('search'), nav: true, 
    title: 'Search/Worklist'},
]);

config.mapUnknownRoutes('home');
config.fallbackRoute('home');    
this.router = router;

}
}
```

and i am still getting the error, so i am confused as to what i need to actually change.

WisdomCorp
@WisdomCorp
Hello, I have a app generated by cli, which have nav-bar.html, this is html only element, now I want to add a login button to it but want the event to be delegated to app.ts, how I can do it ? Thanks
rhys
@rhysshadow
i figured out my problem. i am using aurelia-authentication, and something about how i am calling the app or the login module to show was breaking things. when i commented out that line, it loads again.
rhys
@rhysshadow
what does this error mean?
Error: Unable to find module with ID: app
    at WebpackLoader.eval (aurelia-loader-webpack.js?e63c:197)
    at step (aurelia-loader-webpack.js?e63c:41)
    at Object.eval [as next] (aurelia-loader-webpack.js?e63c:22)
    at eval (aurelia-loader-webpack.js?e63c:16)
    at new Promise (<anonymous>)
    at __awaiter (aurelia-loader-webpack.js?e63c:12)
    at WebpackLoader._import (aurelia-loader-webpack.js?e63c:162)
    at WebpackLoader.eval (aurelia-loader-webpack.js?e63c:262)
    at step (aurelia-loader-webpack.js?e63c:41)
    at Object.eval [as next] (aurelia-loader-webpack.js?e63c:22)
rhys
@rhysshadow

if i change the line in main.js to this:

aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));

i get the following error, and it appears to be complaining still about app?

aurelia-logging-console.js?dc89:45 ERROR [app-router] Error: Error invoking Home. Check the inner error for details.
------------------------------------------------
Inner Error:
Message: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
Inner Error Stack:
Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
    at validateKey (webpack-internal:///3U8n:373:15)
    at Container.get (webpack-internal:///3U8n:512:9)
    at eval (webpack-internal:///3U8n:415:68)
    at Array.map (<anonymous>)
    at Object.invoke (webpack-internal:///3U8n:415:30)
    at InvocationHandler.invoke (webpack-internal:///3U8n:389:28)
    at Container.invoke (webpack-internal:///3U8n:575:28)
    at StrategyResolver.get (webpack-internal:///3U8n:133:39)
    at Container.get (webpack-internal:///3U8n:530:28)
    at eval (webpack-internal:///hij8:4962:71)
End Inner Error Stack

i can't find where the message is being generated so that i can figure out what the call is that is breaking things.

Paul
@Meakeel
@rhysshadow in your Home class there is something in the that is being injected / constructor that it can't find.
rhys
@rhysshadow
@Meakeel thanks - i just found it! thanks for the help.
16 oh4
@16oh4_gitlab
hello everyone, I am new to aurelia. is there a way to use the {...OBJECT} spread operator inside a ${} template? couldn't find an answer anywhere
rhys
@rhysshadow

I am trying to use AJAX to get info from the database. I have set up login.pl and login. js, but all that happens is a reload of the page.

Here's my login.js -> login function:


login() {
        if ( this.username && this.password ) 
        {
            $.ajax({
                type: "GET",
                url: "login.pl", // URL of the Perl script
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                // send username and password as parameters to the Perl script
                data: "username=" + username + "&password=" + password,
                // script call was *not* successful
                error: function(XMLHttpRequest, textStatus, errorThrown) { 
                  $('div#loginResult').text("responseText: " + XMLHttpRequest.responseText 
                    + ", textStatus: " + textStatus 
                    + ", errorThrown: " + errorThrown);
                  $('div#loginResult').addClass("error");
                }, // error 
                // script call was successful 
                // data contains the JSON values returned by the Perl script
                success: function(data){
                  if (data.error) { // script returned error
                    $('div#loginResult').text("data.error: " + data.error);
                    $('div#loginResult').addClass("error");
                  } // if
                  else { // login was successful
                    $('form#loginForm').hide();
                    $('div#loginResult').text("data.success: " + data.success 
                      + ", data.userid: " + data.userid);
                    $('div#loginResult').addClass("success");
                  } //else
                } // success
              }); // ajax
              debugger;
            } // if
            else {
              $('div#loginResult').text("enter username and password");
              $('div#loginResult').addClass("error");
            } // else
            $('div#loginResult').fadeIn();
            return false;
    }

}
rhys
@rhysshadow

now that i have ajax working, i'm getting an error in the console:

GET http://[localhost]:8080/login.pl?username=[object%20HTMLInputElement]&password=[object%20HTMLInputElement] 404 (Not Found)

my directory structure is:

src/
login.html
login.js
login.pl

i have tried in the url field:

/login.pl
./login.pl
login.pl

all give me the same 404 errors.

do i need to configure a route for this script? and if so, how do i go about doing that?