2

I load an AngularJS page by calling this method below in my Java class, just an example. If I have an object, e.g Person, how to send that to the Angular page?

public void init() {
     Person p = this.person; //This is just an example of the object I send
     final JFXPanel fxPanel = new JFXPanel();
     fxPanel.setLayout(new BorderLayout(2,2));
     fxPanel.setSize(new Dimension(1000, 1000));
     fxPanel.setVisible(true);
     Platform.runLater(() -> {
        WebView webView = new WebView();    
        webView.getEngine().load("http://localhost:4200");
        webView.setVisible(true);
        fxPanel.setScene(new Scene(webView));
        });
     add(fxPanel);
 }
James Z
  • 12,209
  • 10
  • 24
  • 44
Kirsten
  • 41
  • 3

1 Answers1

0

I'm not sure about Angular practices, but there is a good practice to pass data as an attribute of a tag with "data-" prefix.

<body data-authenticated-person="{id: 123, fullName: &quot;John Doe&quot;}">
...
</body>
Michael
  • 16
  • 2