How to pass a custom template to the <now-attachments-list> directive?

Z_1
Giga Contributor

Hello everyone,

at this time I'm attempting to pass a custom template to the Service Portal team's oob <now-attachments-list> directive so that I can customize the layout of the items in the attachment list. The directive has a "template" attribute in which makes it seem like a custom template could be passed to it.

So I experimented with this attribute and passed the name of a  template that is defined in the ng-template related list of the widget in which this code is contained. See below:

<now-attachments-list template="attachmentItem" />

However, the template(nothing fancy...) doesn't render. So that leaves me with the question:

How can we correctly pass a custom template to the <now-attachments-list> directive so that we may customize the way in which we display attachment data?

 

1 ACCEPTED SOLUTION

Z_1
Giga Contributor

UPDATE: For anyone that has a similar requirement regarding the <now-attachments-list> directive, I recommend going to the following link for more information: look way further down into the comment section of this thread for @ChrisBurks and @xiaix comments fo... The accepted solution of that thread doesn't directly address how but rather explains why we can't.

View solution in original post

3 REPLIES 3

yundlu316
Kilo Guru

Hey, our team is trying to do the same thing.  Did you ever get an answer to this?  Thanks!

Z_1
Giga Contributor

Hey @yundlu316 

 

apologies for the incredibly delayed response. There was a separate thread where a group of people were after the same thing however it was not updated until the last few months. it contains more information regarding this topic and templates for this directive: 

https://community.servicenow.com/community?id=community_question&sys_id=5f540769dbd8dbc01dcaf3231f9619e5

Z_1
Giga Contributor

UPDATE: For anyone that has a similar requirement regarding the <now-attachments-list> directive, I recommend going to the following link for more information: look way further down into the comment section of this thread for @ChrisBurks and @xiaix comments fo... The accepted solution of that thread doesn't directly address how but rather explains why we can't.