javascript - How to wait till the end of $compile in angularJS -


i'm loading template , compiling against scope using $compile service.

var template = "<div> .. {{somecompilingstuff}} ..</div>"; var compiled = $compile(template)(cellscope); 

and using in popover

cellelement.popover({     html: true,     placement: "bottom",     trigger: "manual",     content: compiled }); 

my template quite complex , may take time compile.

how can make sure angular has finished compiling template before using in popover ?

edit: tried force angular $apply() before creating popover, work generate javascript errors not acceptable me.

$compile allows use called clone attach function allows attach elements document. here example may able use:

var template = "<div> .. {{somecompilingstuff}} ..</div>"; var compiled = $compile(template)(cellscope, function (clonedelement) {   cellelement.popover({     html: true,     placement: "bottom",     trigger: "manual",     content: clonedelement   }); }); 

reference angular documentation $compile usage


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -