Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure I have all the context/code to answer the question but the below code seems to work for me. If <code>?formt=html</code> is not included in the ServiceStack request url it will return a JSON string and the quotes are escaped and \n characters added.</p> <p><strong>Html</strong></p> <pre><code>&lt;div ng-app="testApp"&gt; &lt;div ng-controller="testCtrl"&gt; &lt;p&gt;Write Contents Below:&lt;/p&gt; &lt;div id="writeHere"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>Angular code</strong></p> <pre><code>angular.module('testApp', [], function () { }) .controller('testCtrl', function ($scope, $http) { var req = $http.get('/api/CacheTest?format=html'); req.success(function (data) { $('#writeHere').html(data); }); req.error(function (data) { $('#writeHere').html('Error'); }); }); </code></pre> <p><strong>Request &amp; Service</strong></p> <pre><code>[Route("/CacheTest")] public class ContentValueRequest { public string Group { get; set; } public string Key { get; set; } } public class CacheService : Service { public object Get(ContentValueRequest Request) { var enableCaching = true; if (enableCaching) { var cacheKey = UrnId.Create&lt;ContentValueRequest&gt;("someKey"); var expireInTimespan = new TimeSpan(0, 5, 0); return base.RequestContext.ToOptimizedResultUsingCache(base.Cache, cacheKey, expireInTimespan, () =&gt; { return GetContentValueRequest(Request); }); } else return GetContentValueRequest(Request); } private string GetContentValueRequest(ContentValueRequest request) { var ret = @"&lt;em&gt;""Quoted Text"", &lt;em&gt;Bold&lt;/em&gt;" + Environment.NewLine; ret += @"A second line."; return ret; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload