javascript - Pre compile a directive for use in Google Maps marker causes '$apply already in progress' error -


i creating angularjs app integrates google maps. have html use info popup. use similar chunk of html elsewhere in app, started using directive create re usable component.

once had implemented realised info popup windows need initialised html @ time of creation not @ time of 'popping up'.

i investigated how pre compile directive. same angularjs docs on testing directive.

var element = angular.element("<my-directive data=data></my-directive>"); var scope = $rootscope.$new(); scope.data = somedata; element = $compile(element)(scope); scope.$apply();  element.html(); // gives me html  

this causes error '$apply in progress' know means digest cycle in progress $apply necessary need create precompiled template pass info popup.

i have looked $interpolate , $parse don't think can use these directive has link functions need evaluated.

use

if (!$scope.$$phase)  $scope.$apply(); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -