ServiceNow Angular Directives LIST

adityavishnu
Giga Expert

Is there a list of all directive available like sp-date-picker and sn-record-picker ?

4 REPLIES 4

Harsh Vardhan
Giga Patron

did you try to check in Angular Providers module. 

 

Service Portal > Angular Providers

 

for sn-record-picker.

 

https://YourInstanceID.service-now.com/scripts/sn/common/controls/directive.snRecordPicker.js

 

or you can refer the below url to get the details. 

 

https://YOURINSTANCE.service-now.com/scripts/js_includes_sp.jsx

Brian Workman
Tera Contributor

It would be nice if there were a page that listed the directives and an explanation of how to use them. Like API documentation.

Community Alums
Not applicable

There is a reference guide for spUtil here if it helps.

https://serviceportal.io/sputil-cheat-sheet/ 

Oleg
Mega Sage

There are exist no way to list all directives. You can see someone in Widget Angular Provider [sp_angular_provider] table, but the most other helpful directive you will find only in https://yourinctance.service-now.com/scripts/js_includes_sp.jsx directly. You need just open any page of Service Portal and open Developer Tools of Chrome. Choose file https://yourinstance.service-now.com/scripts/js_includes_sp.jsx and click on the Pretty Print {} button:

find_real_file.png

After that you will get pretty good and readable code, which include all directives, which can be used out-of-the-box. For example you can search for snRecordPicker, spDatePickersnReferencePickerspUtil and so on. Mostly one can search for the text like snRecordPicker.js or spUtil.js or for ".directive(", ".factory(", ".service(", to find the definition of the definition of the directive, factory or service.

You can copy the code and create your modified directive, which is based on the copy of existing directive.