+1

On Tuesday, February 4, 2014 11:58:03 PM UTC-8, Nick Swenson wrote:
>
> Hello all! 
>
> We have run across an issue template rendering and its sucking the soul 
> out of me (not really, but close). Read on for more!
>
>
> *CONTEXT:* We are building an angular application that loads as a third 
> party service on top of other webpages. We have created custom 
> services/factories that evaluate the elements on the webpage (specifically 
> images) and based on certain criteria, dynamically inject our custom 
> elements into certain locations on the webpage. The injection of our 
> elements happens after a response from our api and so can happen up to a 
> few seconds after the page has loaded.
>
> *OUR ATTEMPTED SOLUTION:* Because we dynamically and asynchronously 
> inject elements, we opted to attempt to manually use the $compile service. 
> After the response from our api, we have a list of angular.element wrapped 
> targets that need to have our custom view injected into them. To do that we 
> tried to create an html string with angular attributes (var view = 
> '<div>{{hello}}</div>') and using $compile(view)(scope) tried to append 
> that to body of the page. 
>
> *THE PROBLEM:* For whatever reason, the template we passed to $compile 
> does not render (also tried to wrap the view in jqLite before sending to 
> $compile to no avail). That is, we expect {{hello}}, to be removed and 
> data-binding to occur. This does not seem to be the case. We have created a 
> plunker to to show our issue 
> http://plnkr.co/edit/SVQDpLxM6uXR09vw1PLR?p=preview (We know that 
> manipulating the DOM from a controller is bad practice and plan to change 
> it later.)
>
> *OTHER THINGS WE HAVE TRIED:* We tried using a simple $compile call as 
> well as a directive. In both cases, the template does not render, however 
> the directive is successfully injected into the page. 
>
> *OUR QUESTIONS:* How can we run the template engine? What is blocking 
> angular from doing so? Does anyone have any suggestions for how we could 
> possibly do this better?
>
>
> After looking at pretty much every SO article ever posted and reading the 
> documentation as well as part of the source code, we are at our wits end. 
> Any advice would be greatly appreciated. Heck, even a joke or a witty 
> comment about Russia's $50B spent on the winter games would be appreciated 
> at this point. 
>
>
> Thank you!
> Nick
>

-- 
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/groups/opt_out.

Reply via email to