1 Reply Latest reply on Jan 5, 2017 10:17 AM by mbarkley

    Creating DOM Elements on the fly ! (ManagedInstance<T extends JavaScriptObject>)

    mjm.ent

      How does one create native DOM elements on the fly ?

       

      ManagedInstance<T> works as expected for user defined @Templated objects. But while DOM dependencies are resolved using a simple @Inject of the same class, as far as I can tell, ManagedInstance cannot resolve dependencies for native JavaScriptObjects or DOM elements.. Example :

       

      @Inject

      private Image image; // Works as expected

       

      @Inject

      private ManagedInstance<Image> image; // Results in "Multiple beans matched com.google.gwt.core.client.JavaScriptObject$ with qualifiers { javax.enterprise.inject.Default }"

       

      Elements can be created using the GWT API, example :

      DOM.createElement("img)

      new Image("/img/source.jpg"))

       

      However there appears to be a inherent incompatibility between the GWT API and the Errai API.

       

      Is this functionality supported, what is the correct syntax ?