How to re-render a template in an AngularJS directive?

后端 未结 6 1173
一个人的身影
一个人的身影 2020-12-08 03:22

I\'ve create a directive that generates Twitter buttons. Since the scope variables on those buttons may change, I need to rebuild the button when it happens. Currently, I\'m

6条回答
  •  既然无缘
    2020-12-08 03:56

    What your trying to do follows suit with the compile function within directives, it re-renders the html. Have you tried that?

    This is sort of a hacky way of doing it, but putting an ng-if truthy variable on the directive, and when you want to render, set and unset the truthy variable:

    angularjs: force re-rendering/ full refresh a directive template

提交回复
热议问题