"Error invoking Repeat" When Trying to Bind to Select

I keep running into this error with an innerError of this:

TypeError: Cannot read property ‘isInitialized’ of undefined

The arrays I am trying to load are getting populated correctly from the database in the activate() method and they are publicly accessible. As far as I can tell I have the HTML written correctly.

This is an example:

[div class="form-group row"]
                    [label class="col-sm-4 control-label" for="request-type"]Request Type [span class="required"]${required}[/span][/label]
                   [div class="col-sm-8"]
                        [select id="request-type" class="form-control" value.bind="accessRequest.RequestType & validate"]
                          [option model.bind="null"][/option]
                         [option repeat.for="requestType of requestTypes" model.bind="requestType.AttributeValue"]${requestType.Value}[/option]

It doesn’t matter if I try to coerce the binding value on the option by using value.bind. Do I need to decorate the array with something, and if so, what? I’ve tried @bindable() with no luck.

The template seems normal. Did you try commenting the repeat part out to see whether the error comes from there ?

That is exactly where the error is coming from. Removing the repeat allows the view to load with no errors.

Can you reproduce it in a gist ? https://gist.run/?id=1ae985e6c943885496e8 (fork it and then update & share link)

It might be a few days before I can get to this. I’ve been pulled on to another project.

Here’s the fork, linked to my GitHub:
Aurelia Gist - Repeat Not Working

Aurelia Gist - Repeat Not Working
Aurelia Gist - Repeat Not Working | |

I don’t know if I included enough information in the Gist. I’m kind of new to this kind of development.

Not sure what happened, but here’s the fork:

Stepping through the code in Visual Studio Code, the lines in question seem to be in aurelia-templating-resources/src/abstract-repeater.js and aurelia-templating-resources/src/repeat.js. Repeat seems to be creating an object before it binds to the collection.

I’ve ported your code to the Gist @bigopon provided:

To get it working I needed to remove the TypeScript code and fixed some errors.

I noticed some details in your code that should/would cause problems:

  • In states.push() you’re missing a comma between Id: ... and Name: ...
  • You’re defining a class StandardLookup but pass ordinary objects to states. So the getter displayName doesn’t exist. You should create instances of your class or change the class to be an interface (without the getter)
  • Your call to LoadLookup(); is right within the class definition. Move it to an appropriate method like constructor(), attached() or something like that.

If your problem persists, please try to provide a full example using the Gist provided by @biopon. Just insert your code there, press Create Public Gist afterwards and insert the new url here.

1 Like

I thought I did create the Gist. I forked it as @bigopon suggested.

Be that as it may, I fixed the errors in the Gist. Here’s the URL:

And here is the fork URL:

Remove public states; in app.js (TypeScript syntax again) and change the assignment to this.states = to assign it to a instance property.

Hi, I tried @justcoding suggestion:

It works.

Yes, doing that, it does work, but not in our environment. We are using Typescript and loading the dropdowns from a database.

My colleague has taken a look at what we have done, he has tried to rebuild the system again using the Webpack Skeleton, and gets the same errors.

Our working hypothesis at this point is a version mismatch within the Aurelia libraries that is playing well with Typescript.

1 Like

hi ! im experiencing the same issue with jspm and typescript. changing the aurelia-templating version wont do any good. though the error is manifesting itself in different error messages. is there any way to provide list of compatible aurelia libraries.

i reverted my config.js file back to an old version containing this list of libraries which made the thing work again :

“aurelia-animator-css”: “npm:aurelia-animator-css@1.0.1”,
“aurelia-bootstrapper”: “npm:aurelia-bootstrapper@1.0.0”,
“aurelia-event-aggregator”: “npm:aurelia-event-aggregator@1.0.1”,
“aurelia-fetch-client”: “npm:aurelia-fetch-client@1.0.1”,
“aurelia-framework”: “npm:aurelia-framework@1.1.5”,
“aurelia-history-browser”: “npm:aurelia-history-browser@1.0.0”,
“aurelia-http-client”: “npm:aurelia-http-client@1.2.1”,
“aurelia-loader-default”: “npm:aurelia-loader-default@1.0.0”,
“aurelia-logging-console”: “npm:aurelia-logging-console@1.0.0”,
“aurelia-pal-browser”: “npm:aurelia-pal-browser@1.0.0”,
“aurelia-polyfills”: “npm:aurelia-polyfills@1.1.1”,
“aurelia-router”: “npm:aurelia-router@1.4.0”,
“aurelia-templating”: “npm:aurelia-templating@1.0.0”,
“aurelia-templating-binding”: “npm:aurelia-templating-binding@1.0.0”,
“aurelia-templating-resources”: “npm:aurelia-templating-resources@1.1.1”,
“aurelia-templating-router”: “npm:aurelia-templating-router@1.0.0”,