I am trying to pass ModuleId variable from .ascx control that I need in
order to enable correct and independent function of services if the same
module is placed on the page multiple times.
<script type="text/javascript">
angular.element(document).ready(function () {
angular.bootstrap(document.getElementById("MyModule-<%= ModuleId %>"),
['myModule']);});</script>
Everything works hunky-dory till I drop another instance of the same module
on the page. The reason for that is ModuleId which is disconnected from my c
file
where the module code is declared.
var myModule = angular.module('myModule', ['ngResource']);
At the moment I am using a constant throughout the script to enable correct
function of services.
myModule.value('ModuleId', -1);
Which is initialised by simple DOM lookup during myModule.config().
Is there any way to pass variable/json object into angular.bootstrap(element,
[modules], [config]) function ? Or a better/correct mechanism of achieving
what I am trying to do ?
Config seems like the ideal parameter for this but how do I get that value
in my module.js ?
<script type="text/javascript">
angular.element(document).ready(function () {
angular.bootstrap(document.getElementById("MyModule-<%= ModuleId %>"),
['myModule'], { ModuleId: <%= ModuleId %>, });});</script>
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.