I'm trying to add Simpl5 javascript library to my gateway unsuccessfully. I've put SIPml-api.js and SIPml.js in webapp/content/scripts folder.
In .angular-cli.json I've update scripts array like this :
"scripts": [
"content/scripts/SIPml-api.js",
"content/scripts/SIPml.js"
]
I've then try to call SIPml in component like this :
import { Component, OnInit } from '@angular/core';
declare var SIPml: any;
.
ngOnInit() {
SIPml.setDebugLevel((window.localStorage && window.localStorage.getItem('org.doubango.expert.disable_debug') === 'true') ? 'error' : 'info');
}
I getting ERROR ReferenceError: SIPml is not defined in the console.
Can someone help please ?
You can keep the JavaScript code in a separate external file and then point to that file from your HTML document.
External JavaScript is when the JavaScript Code(script) is written in another file having an extension . js and then we link this file inside the <head> or<body> tag of our HTML file in which the code is to be added.
JHipster
does not fully supports angular cli as @GaëlMarziou already mentioned in comments.
The original idea of supporting the CLI was only for code generation.
So any .angular-cli.json
modificatons won't have any effect as JHipster
is using its own build/serve
chain (have a look in to package.json
custom scripts, they are not based on ng serve/build
, etc ) check this issue discussion for more details.
You need to reference your custom css
and js
in vendor.ts
then when you run npm run serve
you will see the result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With