Angular: How to force recompile directive?

后端 未结 1 2032
甜味超标
甜味超标 2021-02-20 14:13

HTML:

Problem:<

相关标签:
1条回答
  • 2021-02-20 14:44

    Inside your directives link function you need to watch status-stored-in for changes and then recompile it e.g.:

       link: function(scope, element) {
        scope.$watch('statusStoredIn', function() {
          element.html(statusStoredIn);
          $compile(element.contents())(scope);
        });
       }  
    
    0 讨论(0)
提交回复
热议问题