Thanks a lot....This saved me

On Monday, August 27, 2012 at 6:57:16 PM UTC+5:30, Ron Olsen wrote:
>
> Thanks. This is the answer I was looking for. This code works perfectly:
> /* dynamically add the block with the directive to add the template */
> $(element).html("<div ng-include 
> src=\"'templates/templateDynamic1.html'\"></div>");
>  
> /* Get angular to process this block */
> var fnLink = $compile(element);     // returns a Link function used to 
> bind template to the scope
> fnLink($scope);                     // Bind Scope to the template
>  
>
> On Saturday, August 25, 2012 11:08:27 AM UTC-4, Pawel Kozlowski wrote:
>
>> Hi Dan, 
>>
>> On Sat, Aug 25, 2012 at 4:57 PM, Dan Rybij <[email protected]> wrote: 
>> > I'd like to know this too, for roughly the same reasons. I have written 
>> a 
>> > jQuery report widget and I'd like to include angular expressions and 
>> > directives in it. I was going to post roughly the same question: "How 
>> do you 
>> > get angular to process content that's pre-rendered outside of angular?" 
>>
>> In AngularJS the $compile service 
>> (http://docs.angularjs.org/api/ng.$compile) is able to process a piece 
>> of HTML (or DOM) which is pre-rendered outside of angular (I assume 
>> that here you mean HTML with some angular directives / expressions 
>> inside). 
>>
>> To see the $compile in action you can either search for it through 
>> this mailing list or have a look into the ngInclude directive 
>> (
>> https://github.com/angular/angular.js/blob/master/src/ng/directive/ngInclude.js).
>>  
>>
>> It is quite small directive but it fetches an external template and 
>> makes it part of the angular-powered DOM. 
>>
>> If you've got further questions just please send a jsFiddle / plunker 
>> with a skeleton of what you are trying to achieve. 
>>
>> Cheers, 
>> Pawel 
>>
>

-- 
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.

Reply via email to