<now-attachments-list template="sp attachment" />

MCH
Mega Contributor

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

1 ACCEPTED SOLUTION

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");


  }


  };


});


;


View solution in original post

28 REPLIES 28

MCH
Mega Contributor

any answer???


It's a directive defined on the ServiceNow end.


Looks like it accepts a template.


MCH
Mega Contributor

Wow !!!


Thank you so much Chris !


But I still didn't got an answer.


My question is where is the define of this directive? I know that it's in service now, but where in service now?


in which module?


Because I want to usu this directive but with some changes, I have to find it's define in the service now.


I find that there is a module "Angular Providers", but it include only some directives (8), and as I saw during my work, there are a lot of angular directives in the widgets in service portal, so where are they defined?


in order to use a angular directive, you must know what its template, and surely if you want to usu it with some changes you must see the define of the directive...



I am very curious to get a response !!!


Best Regards


Michal.


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");


  }


  };


});


;