I'm trying to create a simple Elm project that just inserts the "hello world!" string into a div.
Here's my code:
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>ELM Course</title>
</head>
<body>
<div id="hello-world"></div>
<script src="hello.js"></script>
<script>
const myDiv = document.getElementById("hello-world");
const app = Elm.Hello.embed(myDiv);
</script>
</body>
</html>
src/Hello.elm
module Hello exposing (..)
import Html exposing (text)
main =
text "Hello world!"
and I compile javascript with the following command:
elm make src/Hello.elm --output=hello.js
The issue arises when I try to open the index.html with a browser and I get this error:
TypeError: Elm.Hello.embed is not a function
The embed
function has been removed in favor of init
. Change the javascript on the const app
line to:
const app = Elm.Hello.init({ node: myDiv });