Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Board function fails in constructor #84

Open
crodgers opened this issue May 24, 2017 · 2 comments
Open

Board function fails in constructor #84

crodgers opened this issue May 24, 2017 · 2 comments

Comments

@crodgers
Copy link

I am trying to use the wgo npm module in Angular.

typings.d.ts:

declare module WGo {
    export default function WGo();
}

in a directive:

import { Directive, ElementRef, Input, OnInit } from '@angular/core';
import WGo from "wgo";
@Directive({
  selector: '[appGoBoard]'
})
export class GoBoardDirective implements OnInit {
  @Input("appGoBoard") sgfData: string;
  elem: ElementRef;
  constructor(el: ElementRef) {
    this.elem = el;
  }

  ngOnInit() {
    let board = WGo.Board(
      this.elem.nativeElement, { 
        width: 200
      }
    );
  }
}

This code produces a js error in the browser:


ERROR TypeError: this.init is not a function
    at Object.Board (Board.js:55)
    at GoBoardDirective.webpackJsonp.204.GoBoardDirective.ngOnInit (go-board.directive.ts:16)
    at checkAndUpdateDirectiveInline (core.es5.js:10705)
    at checkAndUpdateNodeInline (core.es5.js:12084)
    at checkAndUpdateNode (core.es5.js:12052)
    at debugCheckAndUpdateNode (core.es5.js:12681)
    at debugCheckDirectivesFn (core.es5.js:12622)
    at Object.View_SnippetsListComponent_1.currVal_0 [as updateDirectives] (SnippetsListComponent.html:10)
    at Object.debugUpdateDirectives [as updateDirectives] (core.es5.js:12607)
    at checkAndUpdateView (core.es5.js:12019)
@waltheri
Copy link
Owner

waltheri commented Jun 4, 2017

There are two problems - NPM module is not working for now (I have feeling it contains development version). Second WGo.Board is constructor, should be created with new.

@pelevesque
Copy link

I'm planning to use wgo.js in an upcoming project. Is there a roadmap for the development of the 3.0.0 version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants