I created a form using Formsite and I am having trouble embedding the code into my page. Their embed code from their site looks something like this:
<a name="formvtjqi9JE" id="formAnchorvtjqi9JE"></a>
<script type="text/javascript" src="//www.formsite.com/include/form/embedManager.js?vtjqi9JE"></script>
<script type="text/javascript">
EmbedManager.embed({
key: "www.formsite.com/form_app/Formsite?EParam=IRLY%2&vtjqi9JE",
width: "100%",
prePopulate: { "2":"Alex", "3":"Powers","4-1":"1","4-2":"2"},
resizeCallback: yourFunction,
showFormLogin: false,
mobileResponsive: true
});
</script>
My page won't load the javascript file directly on the page since it uses controllers for all of it's javascript. Is there a way to load this script into a controller? I think my issue is related to this AngularJS: How to make angular load script inside ng-include? but I wasn't able to get that working with the embed code.
Sidenote
I know the embed code works because if I create a blank html page and just copy and paste the embed code it will appear.
Clarification (apologies in advance I am just learning angular)
The format of the site looks like it keeps everything in the index.html
so this page only has all of the scripts which look something like this
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet"><!-- main.css is output from main.scss, NOT A WORKING FILE -->
<!-- Theme CSS -->
<link href="vendor/pictonic/css/pictonic.css" rel="stylesheet">
<link rel="icon" type="image/png" href="img/header/syn_emblem.png">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-ui-router.min.js"></script>
<script src="js/myapp.js"></script>
<script src="./vendor/pictonic/js/pictonic.min.js"></script>
<!-- typekit fonts -->
<script src="https://use.typekit.net/yqg2zpp.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
<!-- directives -->
<!-- controllers -->
<script src="js/home.controller.js"></script>
<script src="js/navigationController.js"></script>
<script src="js/survey.controller.js"></script>
Attempt 1
I have another html which is the survey.html where I want to put the form I created. But if I just copy and paste the embedded code from above into this nothing appears. This page doesn't have any <script>
tags in it's html so I am guessing that I have to put the embed code somewhere else which leads to...
Attempt 2 I took the line
<script type="text/javascript" src="//www.formsite.com/include/form/embedManager.js?vtjqi9JE"></script>
and put that into the index.html
and I am trying to take the second script portion of that and put that into the survey.controller.js
so that portion I am adding is looking something like.
(function (ng) {
'use strict';
var surveyPage = ng.module('ngLoadScript', []);
surveyPage.directive('script', function() {
return {
restrict: 'E',
scope: false,
link: function(scope, elem, attr) {
EmbedManager.embed({
key: "https://fs27.formsite.com/res/showFormEmbed?EParam=blabla",
width: "100%",
mobileResponsive: true
});
}
};
});
}(angular));
Which doesn't work either.