Hi Neil,

For now, you can let your server include it in a script tag, and then pull 
that in. 

In your template:
<script type="application/json" id="config">
{
"unicorns": "awesome",
"abc": [1, 2, 3]
}
</script>


In your component:
class AppComponent {
config

ngOnInit() {
this.pullFromScript();
}
pullFromScript() {
if (document && document.querySelector) {
// I can reasonably assume the above if makes sure this only in the browser
this.config = JSON.parse(document.querySelector("script#config").innerHTML)
}
}
}


I have been talking with some of the core members to add a parameter to the 
bootstrap function, so this can be done a bit cleaner.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" 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