November Happy Hour will be moved to Thursday December 5th.

URL rewriter crashes knockout.js templates

Vote:
 

I have the exact same problem as described in URL rewriter crashes knockout.js templates: http://world.episerver.com/forum/developer-forum/EPiServer-CMS-6-R2/Thread-Container/2013/3/URL-rewriter-crashes-knockoutjs-templates/, but we are running EPI Server 9.6. 

The short version is that the UrlRewriter messes upp the HTML comments inside the script-tag. I have tried to add a custom UrlRewriter as described in the post above, but I never get the complete HTML from the Script-tag and therefor the Regex never gets a match. I have tried to wrap all my Templates within a div with a EpiNoRewrite="true" attribute without success.

How can I prevent the UrlRewriter to mess with my HTML? 

Thanks, Eric

#147692
Apr 21, 2016 13:51
Vote:
 

This HTML in our ASPX-page:

    <script id="itemTmpl" type="text/html">

        <li data-bind="style: { 'margin-left': $data.Children == null ? '-28px' : '0' }">

        <!-- ko if: $data.Children != null -->

        <div style="line-height: 28px" data-bind="text: VisningsNamn"></div>

        <!-- /ko -->

        <!-- ko if: $data.Children != null -->

        <ul style="margin-left: 30px" data-bind="visible: $data.Children != null, template: { name: 'itemTmpl', foreach: $data.Children }"></ul>

        <!-- /ko -->

        </li>

    </script>

Becomes 

<script id="itemTmpl" type="text/html">

    <li data-bind="style: { 'margin-left': $data.Children == null ? '-28px' : '0' }"> 

    <!-- ko if: $data.Children != null --></></script></div>-- /ko --> 

    <!-- ko if: $data.Children != null --> 

    <ul style="margin-left: 30px" data-bind="visible: $data.Children != null, template: { name: &#39;itemTmpl&#39;, foreach: $data.Children }"></ul> 

    <!-- /ko --> 

After EPI has processed it.

#147696
Apr 21, 2016 14:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.