I'm currently trying out to load scripts in the NG client.
I have made following test files:
html:
- Code: Select all
<html>
<head>
<script type="text/javascript" src='/scripting/scripting/originalscript/scriptje.js'></script>
<head>
<body>
<p>Before the script...</p>
<script type="text/javascript">test()</script>
<p>...After the script.</p>
</body>
</html>
custom js file with script:
- Code: Select all
function test(){
alert( 'works');
}
component js file:
- Code: Select all
angular.module('scriptingScripting',['servoy']).directive('scriptingScripting', function() {
return {
restrict: 'E',
scope: {
model: '=svyModel'
},
controller: function($scope, $element, $attrs) {
},
templateUrl: 'scripting/scripting/originalscript/scriptings.html'
};
})
spec file:
- Code: Select all
{
"name": "scripting-scripting",
"displayName": "scripting",
"version": 1,
"definition": "scripting/scripting/scripting.js",
"libraries": [],
"model":
{
"yourName" : {"type": "string", "default":"World"}
}
}
When I run the NG client, it runs.
I see the alert button and the html paragraphs, so you would think that there is no problem.
But there is...
What should happen is that it first loads paragraph: Before the script..., then the alert and when you press ok it has to load the last paragraph: ...After the script.
Not all together.
I also have an warning Synchronous XMLHttpRequest on my head thread, but I don't think that's causing the problem.
Does someone know how to load the script before the last paragraph instead of all together?
Thanks,
Walter