# Problem updating Aurelia bind method to typescript

**URL:** <https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894>\
**Category:** Help Requests\
**Created:** [September 3, 2019, 11:49pm UTC](https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894 "2019-09-03T23:49:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KPLATTER](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@KPLATTER](https://discourse.aurelia.io/u/KPLATTER)\
**Post date:** [September 3, 2019, 11:49pm UTC](https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894/1 "2019-09-03T23:49:12Z")

</div>

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
  view.bind(this.bindingContext);

  // Add the view to the slot
  this.viewSlot.add(view);

  // Trigger the attach for the slot and its children.
  this.viewSlot.attached();

  if (this.bindingContext.interFace.view.code) {
    eval(this.bindingContext.interFace.view.code);
}

bind(bindingContext) {
  this.bindingContext = bindingContext;

  this.interFace = bindingContext.interFace;
}

```

}  
`

---

<div class="post-metadata">

**Author:** ![khuongduybui](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/khuongduybui/32/44_2.png) [@khuongduybui](https://discourse.aurelia.io/u/khuongduybui)\
**Post date:** [September 4, 2019, 3:35am UTC](https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894/2 "2019-09-04T03:35:51Z")

</div>

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

> **[aurelia-contrib/aurelia-dynamic-html](https://github.com/aurelia-contrib/aurelia-dynamic-html)**
>
> Aurelia custom element that takes (server- or client side) generated html and compiles it into a fully functional Aurelia View - aurelia-contrib/aurelia-dynamic-html

---

<div class="post-metadata">

**Author:** ![KPLATTER](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@KPLATTER](https://discourse.aurelia.io/u/KPLATTER)\
**Post date:** [September 4, 2019, 12:10pm UTC](https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894/3 "2019-09-04T12:10:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KPLATTER](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@KPLATTER](https://discourse.aurelia.io/u/KPLATTER)\
**Post date:** [September 4, 2019, 1:01pm UTC](https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894/4 "2019-09-04T13:01:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![EisenbergEffect](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/eisenbergeffect/32/2655_2.png) [@EisenbergEffect](https://discourse.aurelia.io/u/EisenbergEffect)\
**Post date:** [September 4, 2019, 4:40pm UTC](https://discourse.aurelia.io/t/problem-updating-aurelia-bind-method-to-typescript/2894/5 "2019-09-04T16:40:23Z")

</div>

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