Search code examples
angularangularjs-ng-include

Ng-include analog in angular2 for HTML inserting


I have view written on angular1

<script type="text/ng-template" id="table_item_renderer.html">
        ...
        <div layout="column" flex ng-repeat="data in data.nodes" ng-include="'table_item_renderer.html'"></div>
        ...
</script>

<div >
        ...
        <div layout="column" flex ng-repeat="data in data.nodes" ng-include="'table_item_renderer.html'" ></div>
        ...
</div>

How can I implement this including logic into my HTML code in angular2?


Solution

  • I have been wondering this myself. The truth is angular 2 does not play very well with things that manipulate the dom. That's why they deprecated ng-include with no replacement. However that said checkout this: https://www.npmjs.com/package/ng-include which kind of worked for me.