angular is not defined Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2016 02:20 AM
Following : AngularJS: Developing Modern User Interfaces getting
Uncaught reference error : angular not defined:
/*! RESOURCE: service.sn-glideAjax */
angular.module('sn.glideAjax', []);
Any Clue how to resolve this issue.
I have following UI Script defined in Global scope:
service.sn-glideAjax
angular.module('sn.glideAjax', []);
angular.module('sn.glideAjax').service('GlideAjax', function($rootScope) {
var glideAjax = window.GlideAjax;
glideAjax.prototype.getJSON = function(callback) {
this.getXMLAnswer(function(answer) {
var answerJSON = JSON.parse(answer);
callback(answerJSON);
$rootScope.$apply();
});
};
return glideAjax;
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2016 09:55 PM
Hi Spandan,
are you loading sn.glideAjax in your main app module? if not then it will give you an error. and before using GlideAjax service in any controller make sure you inject it in that controller.
i hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2016 11:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2016 12:03 AM
everything looks fine.
can you load your scripts like this.
<script>https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script>
<script>
<g2:evaluate var="jvar_stamp">
var gr = new GlideRecord('sys_ui_script');
gr.get("cf4ad1154f6452008c8a7bb28110c725"); //sysid of your ui script
gr.getValue('sys_updated_on');
</g2:evaluate>
<g:requires name="yourapp.youruiscript.jsdbx" params="cache=$[jvar_stamp]" />
make sure you have not made anychanges in sn-glideAjax script. if you have then it will not reflect as it will be cached by the browser.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2016 05:56 PM
I had the same issue initially, big guy.
Just add the script in the same app scope you're working on and make it accessible to all scopes.
Make sure to include your scope prefix when sourcing it from your UI page:
<script> |