- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2020 12:47 PM
We're trying to use a template within a widget for the service portal and even the simplest example is not working, so there must be a step I'm missing.
From examples in the system with OOTB widgets they use this to pull in the template
<div ng-include="template_id"></div>
When doing the same thing for a simple example below, the template doesn't load. What's the proper method to pull in a ng-template?
HTML Template
<div>
<h1>This is a widget</h1>
<div ng-include="test"></div>
</div>
Client Script
function() {
/* widget controller */
var c = this;
}
Server Script
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
})();
Angular ng-template: test
<strong>Hello world!</strong>
HTML Output
<div>
<h1>This is a widget</h1>
<!-- ngInclude: test -->
</div>
Output screenshot
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2020 06:36 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2020 06:33 PM
In my own instance I am able to get it to work like so:
<div data-ng-include="'test'"></div>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2020 06:36 PM
It should also work like:
<div ng-include="'test'"></div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2020 07:11 PM
With the template id as test this works
<div data-ng-include="'test'"></div>
Apparently it needed the single quotes, it doesn't work without them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2020 05:36 PM
Take a look at the below article:
Please mark my response as correct answer and helpful if it helped solved your question.
-Best Regards
Prateek kumar
Please mark my response as correct and helpful if it helped solved your question.
-Thanks