I created a new anglure cli project. I want to use the chessboardjs2 library. It's documentation: https://chessboardjs.com/v2/examples and is github: https://github.com/oakmac/chessboard2
I was able to get the npm package:
npm install @chrisoakman/chessboardjs2
Screen of the content of this package:
but then I was unable to find out how to import it in a component.
I was able to import the library directly in index.html and use it:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Chess board</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- <link rel="stylesheet" href="https://unpkg.com/@chrisoakman/chessboard2@0.3.0/dist/chessboard2.min.css" integrity="sha384-5cxVYodq78gDJaWQIc5iBCUhFERY+VjHOszl2K7BTbZwBbrzQH2IYhOliWHJy6X3" crossorigin="anonymous">
<script src="https://unpkg.com/@chrisoakman/chessboard2@0.3.0/dist/chessboard2.min.js" integrity="sha384-v+CI0A3P1tu1MDM6cJaBosdhRHCfZlJrhHUFWBGtckCzH/ChKw9EhDHEWGmPkp8t" crossorigin="anonymous"></script> -->
</head>
<body class="mat-typography">
<app-root></app-root>
<div id="myBoard" style="width: 200px;"></div>
<script>
const board = Chessboard2('myBoard')
</script>
</body>
</html>
But this implementation does not allow me to use it in a component.
What can I do?
This is my first angular project and I might not understand everything... I also tryied to insert the chessboard2.min.js and the chessboard2.css in the angular.json without success.
Thanks for your help
EDIT: I am looking for a solution to use the js function of chessboard2.min.js inside a component. Not in the index.html body.