I have created a directive to put element html code in template cache-
.directive('putInCache', function ($templateCache) {
return {
link: function (scope, element) {
$templateCache.put('name', element.html());
}
};
})
I am using it in html like this-
<div put-in-cache class="modal">
<div class="modal-body">
<div ng-repeat="result in results">
{{ result }}
</div>
</div>
</div>
Problem is that element.html() return ng-repeat code as <-- ng-repeat result in results -->
due to which ng-repeat does not work in modal template.
Any ideas how can I put the actual html before ng-repeat rendering in cache
PS - I can't use script ng-template or define template in js, hence created this directive.