Search code examples
javascriptangularjsangularjs-ng-include

How to use ng-include with an html file in double curly brace notation {{ }}


I have the following code:

<div  ng-repeat="pTabs in child.productTabs" ng-click="toggleProductTab($index)" ng-if="productTabIsActive(pTabs, $index)">
    <div ng-repeat="specs in pTab.additionalSpecs">
        <p>{{specs.content}}</p>  <!--Displays url-->
        <div ng-include  src = {{specs.content}}></div>  <!--My attempt to display the html content-->
    </div>
</div>

{{specs.content}} is an html file containing the html I want to use on the page. When I wrap it in the <p> tag, the URL is displayed as text on my page. How can I add the html content to my page using ng-include? I've tried to changing the syntax up but nothing has worked thus far.

Thank you very much for your time.


Solution

  • As far as i know, you didn't have to use the curly braces notation inside an angular directive. Use ng-include src = specs.content