In my appsettings.json file, I have a flag that I can set to enable or disable a learning assignment called "Telescope", like this:
"Telescope": {
"Enable": false
},
In my Startup.cs, I can successfully check to see if it is enabled or not:
if(Configuration.Telescope.Enable) {
... do something ...
}
But I'm not sure how to transfer that logic down to my Backbone components.
For example, I have this in a Backbone model:
this.telescopeArray = new TelescopeCollection();
this.telescopeArray.url = () => `/assignments/telescopes/location/${this.id}`;
And this, in an html template:
<a href="/assignments/telescopes/students/{{ ctx.locationId }}/">Start Your Learning Assignment</a>
As I said above, I can enable or disable "Telecope" in my appsettings.json file, and I can see that it's either enabled or disabled in the c# part of my app, but I'm not sure how to enable or disable the lines of code in the Backbone part of my app.
Is there a way to do this in Backbone?
Thanks!
I can think of following ways:
<meta>
tag or as <script>
etc. Later other parts of your app can query this, or better just query it on Backbone app initialization and set it on a model/state store for easy access later.