I have pretty much followed the code linked here 
<http://javahonk.com/angularjs-read-property-file-using-service-controller/>, 
except my service and controller are in their own .js files. I have 
config.properties file with JSON (2 key/value pairs...nothing too crazy) 
and I need them inside my html file like so:

<html ng-app="myApp" ng-controller="ConfigCtrl">
    <head>
        <!-- Piwik -->
        <script type="text/javascript">
        var _paq = _paq || [];
       _paq.push(['trackPageView']);
       _paq.push(['enableLinkTracking']);
       (function() {
       var u={{piwikUrl}};
       _paq.push(['setTrackerUrl', u+'piwik.php']);
      _paq.push(['setSiteId', {{piwikSiteId}}]);
       var d=document, g=d.createElement('script'), s=d.getElementsByTagName
('script')[0];
       g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+
'piwik.js'; s.parentNode.insertBefore(g,s);
       })();
       </script>
       <!-- End Piwik Code -->
</head>

 However, it seems that you can't use a scope variable in the head. I get 
the error "Uncaught SyntaxError: Unexpected token {" for the line where 
{{piwikUrl}} is located in the code above. If it is in quotations, then my 
the URL being provided to the new <script> element being created becomes 
"{{piwikUrl}}piwik.js". Is it possible to use scope variables inside the 
head tag/script tag? If so, how do I do it?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to