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 02:30 AM
Angular not defined pretty much means that the library isnt loaded.
just to test.. put this in your code:
<script> src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
just to see if that will work.. then it's how you load your ui script that isn't working.. Haven't done these labs myself, so not sure what they do in them.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2016 07:27 PM
Thanks Goran, the Angular JS file is loaded from CDN , & I can see two way binding is working, but when it comes to add an dependency as mentioned in Lab to get data from Servicenow GlideAjax to Angular .. it is failing. I will debug more & see if I am missing anything else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2016 02:07 PM
Hi Spandan,
if you are following : AngularJS: Developing Modern User Interfaces using AngularJS_Lab_Guide.pdf
Lets go one step back to your UI PAGE & UI SCRIPT. Can you check if you have these in place ?
According to the lab guide: If everything is in place you should see a blank page with a single input field. Whatever you type in that field should automatically print right next to it. This demonstrates a very basic Angular feature, using a UI Script to import Angular, and a UI Page to bring it all together.
If above UI page works for you, it should not show "Uncaught reference error : angular not defined" at all. If it does please check your UI script.
Hope this help!
-Manjul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2016 07:28 PM
Thanks Manjul, the Angular JS file is loaded from CDN , & I can see two way binding is working as your example , but when it comes to add an dependency as mentioned in Lab to get data from Servicenow GlideAjax to Angular .. it is failing. I will debug more & see if I am missing anything else.