Context is I am working on the mobile environment,so i try to cache the
compiled DOM element into memory like this:
cache[key] = $compile(myTemplate)(newScope);
and update the other element's content like this:
$('myElement').html(cache[key]);
the first time everything work well, and then i clear myElement's content
and use the cache to update myElement's content again like this:
$('myElement').empty().html(cache[key]);
and the scope of the cached compiled template disappear(the scope of the
cache[key]).
I don't want use:
$compile(myTemplate)(scope, function(compiledTemplate) {
cache[key] = compiledTemplate;});
to compile template and apply to scope every time, so if there any way can
cache the compiled Dom element with scope, please help me, Thanks.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.