- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 11:34 PM
Hello,
I used the widget 'Ticket Attachments' in Service Portal of Helsinki.
In this widget there is an element which call 'now-attachments-list'.
I want to understand what the meaning of this element, maybe it's a directive of angular? so, where it's defined?
I would be happy if someone can explain me what is it exactly.
thanks,
Michal
Solved! Go to Solution.
- 10,905 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 03:53 AM
Michal,
I apologize that my answer was not clear. When I stated that it was on the ServiceNow side, I meant that it's not directly accessible to us. It's directly accessible to ServiceNow employees on their side. You won't find it under any Module, Angular Providers or dependency sections.
That said, it doesn't mean you can't get to it. With a closer look by doing an Inspection, you can see how the directive is defined.
Here is the directive script:
angular.module('sn.common.attachments').directive('nowAttachmentsList', function(getTemplateUrl) {
'use strict';
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl("attachments_list.xml"),
link: function(scope, elem, attrs, $parse) {
scope.icons = {
preview: attrs.previewIcon,
edit: attrs.editIcon,
delete: attrs.deleteIcon,
ok: attrs.okIcon,
cancel: attrs.cancelIcon
};
scope.listClass = "list-group";
var inline = scope.$eval(attrs.inline);
if (inline)
scope.listClass = "list-inline";
scope.entryTemplate = getTemplateUrl(attrs.template || "attachment");
}
};
});
;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 06:26 AM
Hi Chris,
Thank you so much !
I was sure that the directives are defined in somewhere...and didn't think on the option that they are not available for us.
Thank you so much
Good luck !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 06:39 AM
Michal,
You're welcome. Glad I could help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2016 01:28 AM
Hi Chris,
I have another question regarding this directive:
As you can see, the template of the directive ( HTML) isn't in the code below.
- templateUrl: getTemplateUrl("attachments_list.xml"),
So, do you know where I could find it?
I have another directive "spModel" that I want to find his HTML, but the template not write in the directive but also in XML.
I want to know how I could find his HTML?
This is the directive:
/*! RESOURCE: /scripts/app.$sp/directive.spModel.js */
angular.module('sn.$sp').directive('spModel', function($timeout, spUtil, glideFormFactory, glideUserSession, catalogItemFactory, glideFormEnvironmentFactory, catalogGlideFormFactory, spUIActionFactory, glideModalFactory, $uibModal, glideListFactory) {
'use strict';
return {
restrict: 'E',
templateUrl: 'sp_model.xml',
replace: true,
scope: {
formModel: "=",
mandatory: '=',
isInlineForm: '=?'
},
controller: function($element, $scope) {
---
etc...
Thanks !
Michal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2016 09:09 AM
Hi Michal,
For the sp_model.xml, that can be captured by navigating to the sp portal and doing an inspection as well. Within the element inspection section do a "find" for "ng-template" and you'll see a few of the templates used. Or just do a find exactly for what you want, in this case sp_model.xml, and click the dropdown arrow beside it and you'll see the template markup.
Unfortunately, attachments_list.xml looks like it is handled by a processor through the angular.do? path. That's only a guess on my part though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2018 03:56 AM
So, is there any other way to get attachments template?
I suppose it will work if we provide our custom template ie. <now-attachments-list template="my_template"/>