$render stopped working at angular 1.2.2 (file validation directive)

后端 未结 2 796
灰色年华
灰色年华 2021-01-12 18:53

I have migrated from angular 1.0.8 to angular 1.2.2 yesterday, and beside a bunch of other things that got broken and I\'ve already fixed, the $render function on the follow

2条回答
  •  时光取名叫无心
    2021-01-12 19:17

    I've tested this with angular 1.2.10 for a textbox and whatever priority I set, original input $render method was set afterwards overriding my $render function.

    This problem occurs in angular-ui tinymce module as well which can not render the initial model value. So I changed the timeout part in tinymce directive to override the original $render method as follows:

    var render = function() { // my rendering code }    
    setTimeout(function () {
                          tinymce.init(options);
                          if (ngModel.$render != render) {
                              var originalRender = ngModel.$render;
                              ngModel.$render = function() {
                                  originalRender();
                                  render();
                              };
                      }
                  });
    

    This way, after all "link" functions are executed, you can override the render method.

提交回复
热议问题