Search code examples
javascriptangularjsangular-ui-bootstraptextangular

textAngular links from modal dialog sets variable but doesn't apply it to DOM


Using the textAngular plugin, I'm unable to apply to the DOM a newly set variable. I'm implementing a angular bootstrap UI modal, and I can see the variable is set correctly so the issue appears to be with editorScope.updateTaBindtaTextElement().

Here is my code in the onElementSelect block:

reLinkButton.on('click', function(event){
   event.preventDefault();

   var modalInstance = $modal.open({
      templateUrl : '/templates/dialog/linkMaker.html',
      controller  : 'linkMakerDlgCtrl',
      resolve     : {
         // variables here ...
         }
      }
   });
   modalInstance.result.then(function (link) {

     $element.attr('href', 'http://' + link.ref); // <== a console.log of this returns the correct value
     editorScope.updateTaBindtaTextElement(); // <== new value not applied to DOM

   }, function () { $log.debug('Modal dismissed'); });

   editorScope.hidePopover();
});

As a note, this follows a previous question with a similar issue on the action block and where the solution was to add a promise and return false. I tried that but it didn't resolve my problem.


Solution

  • Solved by updating textAngular version from 1.2.2 to 1.4.3.