Integrating GWT and angular2

I have a big project in GWT and I'm trying to integrate Angular2 with it. ( angular2-gwt is not an option, since I am working on version 2.7 and cannot upgrade to 2.8 at that time)

I ran into several issues that I don't seem to know about how to look about:

1) I heard that you can use JSNI to use the angular application, but I didn't seem to be able to do this or find any information about this. how does it work and what can i do with it? (calling a function is an option?)

2) I tried to add the angular application selector tag to the GWT html entry point, and this works fine, but when I try to add the selector to the .ui.xml file (interface binding), it does not work, why?

3) Is it possible to call the client side of GWT from the servlet? I mean, I'm in an Angular2 application and use a call to rest, can this call to rest cause something on the client side of the GWT?

Thank!

+4
source share
1 answer

First of all, I should note that the transition from GWT 2.7 to GWT 2.8 was quite painless for me. I updated my applications and did not have serious problems (some changed Maven dependencies, some flag here and there, etc.). I mention this because JS support is greatly improved in GWT 2.8 versus GWT 2.7, so if at all possible, you really need to make a switch.

Regardless, in GWT 2.7:

  • JS GWT :

public static native void sayHello() /*-{ $wnd.alert("Hello world!"); }-*/;

$wnd, "" JS (.. JS alert() ).

, , JS (, angular), . , JS, . , , gwt-openlayers http://www.gwtopenlayers.org/ , ( JS)

  1. angular, .ui.xml - . / - . , HTML, - g:HTMLPanel, , , JS .
  2. , . , ; , .., . , , , .
+1

Source: https://habr.com/ru/post/1676817/


All Articles