Getting Started with AngularJS in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2014 06:24 AM
At the K14 conference I heard of a few customers starting to use AngularJS within ServiceNow, so I started doing some reading on Angular. Are there any good articles, tips/tricks for getting started with AngularJS in ServiceNow?
Thanks
Rick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2015 11:02 AM
Hey Greg - I'm hardly an Angular guru, but I do know a few ServiceNow tricks. That syntax checker runs without regard for the fact that we're using Angular, and so it tries to save us from typical 'non-Angular' issues. Usually good; in this case, a nuisance.
The good thing is that the syntax checker runs client-side and only on the form view. To get around it, try this:
- Complete your code either on the form view or in another syntax editor. Copy it to your clipboard.
- In SN, add the 'HTML' field to the listview for your UI Page list.
- For your specific UI Page, double click the 'HTML' field from the listview.
- Paste in your contents and click the green check-mark to save.
- Now, click to open the formview of your UI Page - it should contain your code as desired!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2015 11:05 AM
Thanks for the quick reply Ben. Yeah, I learned that trick from you earlier, but when I still put the URL in for my UI Page, the result is below. I will keep digging. Thanks!
Error during script processing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2015 11:24 AM
Hey Greg - Are you able to call the directive directly without the need for the div tags? ie:
<dhx-scheduler data="events" style="height:600px; width:800px"> </dhx-scheduler>
I haven't actually tried this (and, again, not a Angular guru), but I've seen the syntax used...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2015 11:39 AM
try doing this with the div:
<div data="events" dhx-scheduler="" style="height:600px; width:800px;">
Since the macro is xml based xml is strict. It won't allow the attribute of an element not to have a value. It's expecting every attribute to be followed by an equals sign.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2015 11:44 AM
But yes creating a directive for dhx-shceduler would be better since you're using Angular