CODEPEN here: http://codepen.io/anon/pen/dGeNLK
I have a $http response like the following.
$http({
method: 'GET',
url: _spPageContextInfo.webAbsoluteUrl + "/itemsSite/_api/web/lists/getByTitle('items')/items?$select=*",
cache: true,
headers: { "Accept": "application/json;odata=verbose" }
}).success(function (data, status, headers, config) {
$scope.items = data.d.results;
}).error(function (data, status, headers, config) {
});
The results, of which there are usually between 50 and 100, look somewhat like this
{
name: 'Item One',
desc: "Item 1 [ITEM:1]View 1[/ITEM] Item 1b [ITEM:1b]View 1b[/ITEM] Item 1c [ITEM:1c]View 1c[/ITEM]"
},
{
name: 'Item Two',
desc: "Item 2 [ITEM:2]View 2[/ITEM] Item 2b [ITEM:2b]View 2b[/ITEM] Item 2c [ITEM:2c]View 2c[/ITEM]"
},
{
name: 'Item three',
desc: "Item 3 [ITEM:3]View 3[/ITEM] Item 3b [ITEM:3b]View 3b[/ITEM] Item 3c [ITEM:3c]View 1c[/ITEM]"
}
And are then displayed using an ng-repeat like.
< div ng-repeat="item in items">
< div class="col-sm-12" ng-bind-html="item.details | filter:search">< /div>
< /div>
Inside each is a block of text which potentially contains multiple strings from an old system that resemble the following.
[item:id]item name[/item]
How would I transform the json so that any instances of the above string could be intercepted and transformed into a clickable modal link such as
< a ng-click="viewItemDetails('1a');" >View 1a< /a >
I cannot change the structure of the text blocks.
NOTE: I have asked a similar question before and the suggestions neither worked nor were very graspable.