Service Portal - Dynamic HTML Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 10:55 AM
Hi,
Based on Company of user, below highlighted lines are supposed to appear / disappear on homepage on my SP.
I can use gs.getUser().getCompanyID() in Server Script to publish different results based on Company but how can I make the HTML Texts disappear based on that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 11:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 01:36 PM
Hi Arnab,
In the server script set a data attribute saying if it should be displayed. EX:
var visibleCompanies = ['sys_id1', 'sys_idx'];
if(visibleCompanies.indexOf(gs.getUser().getCompanyID().toString()) > -1){
data.visible = true;
}
else{
data.visible = false;
}
Then use the data object inside your HTML template to display or not display a specific HTML tags:
<tag ng-if="data.visible">Content</tag>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 01:47 PM
I did it via passing the HTML content also into the server data.answer query parts...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 04:09 PM
Hi Arnab, just got a chance to look at this, but I agree with Laurent. That is the right way to do it. use the ng-if attribute on your center or p1 elements, or you can wrap those 2 sections in another div or p element and add the ng-if to that.