Problem updating Aurelia bind method to typescript

I have a Aurelia component that I am trying to move to typescript. The component was created a long time ago and the class method bind is giving me Typescript error. I am not sure if the bind method changed names or what.

The error is: Cannot find name ‘bind’. Did you mean the static member ‘InlineView.bind’?

Here is the component:

export class InlineView {
viewCompiler: ViewCompiler = undefined;
viewSlot: ViewSlot = undefined;
container: Container = undefined;
viewResources: ViewResources = undefined;
interFace: any = undefined;
bindingContext: any = undefined;

constructor(viewCompiler, viewSlot, container, viewResources) {
  this.viewCompiler = viewCompiler;
  this.viewSlot = viewSlot;
  this.container = container;
  this.viewResources = viewResources;

attached() {
  // Compile an html template, dom fragment or string into ViewFactory instance, capable of instantiating Views.
  var viewFactory = this.viewCompiler.compile('<template>' + this.interFace.view.html + '</template>', this.viewResources);

  // Creates a view or returns one from the internal cache, if available
  var view = viewFactory.create(this.container);

  // Bind the view and it's children

  // Add the view to the slot

  // Trigger the attach for the slot and its children.

  if (this.bindingContext.interFace.view.code) {

bind(bindingContext) {
  this.bindingContext = bindingContext;

  this.interFace = bindingContext.interFace;


1 Like

I don’t have the exact answer to your question, but perhaps you can take a look at this plugin?

1 Like

Well that was a great find. Thank you so much. It turns out the error was an errant “{” on this line

if (this.bindingContext.interFace.view.code) {

But that plugin is much nicer than my module so I am going to switch over to it. Thanks for you help.

Anyone needing to dynamically create an Aurelia view should take a look at the plugin. I think they should make the plugin part of the vNext spec.

1 Like

Well the install of the plugin was a little bit of a challenge. The instructions reference a “au install” or a “au import”, are those only for RequireJS or SystemJS? Or are they no longer supported?

@EisenbergEffect Again I think this should be built into the specs and get merged in with or replace the “compose” element.

1 Like

For Aurelia 2, we’ve greatly improved the compose element, so that this is now possible with very basic APIs :smile: