Answer the question
In order to leave comments, you need to log in
Is it possible to use inline JS in Angular?
In continuation of this question. Here's a finished example: jsfiddle.net/nynqqfz1/6 . With child $scope everything works fine. The problem is that it is necessary for the server to give the contents of the menu in HTML, and not in a static JS file. Because that's how i18n and Spring Security tags work - the contents of the menu vary depending on the user's language settings and privileges.
The menu should be given directly to index.html and not requested through a separate Angular service, as an option.
Question: how to slip $scope.data = [] into the controller via Inline JS ?
PS They didn't ban me on Google, but they don't recommend anything sensible there.
Answer the question
In order to leave comments, you need to log in
How about this option:
<script>
angular.module('app').value('sideMenuData', {{ myData | json }});
</script>
<script>
angular.module('app.inlineData', []).value('sideMenuData', {{ myData | json }});
</script>
Because that's how i18n and Spring Security tags work - the contents of the menu vary depending on the user's language settings and privileges.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question