I would add callback function for directive ('loadData'), that user specify
in html, and it will be used to make request. And then specify another
scope object in html ('data'), that will be used to populate data from http
request. Http call and resolve will be done completely in that specified
callback function 'loadData' (this allow to use any http provider) and
promise is resolved to scope object specified in 'data'.
On Sunday, October 26, 2014 7:56:51 PM UTC+2, Aviad Pineles wrote:
>
> Hello folks, I'm trying to achieve something that's apparently not so
> easy. I want to be able to load data dynamically when the user hovers for
> over 500 msec over an element. Once that data is loaded I want to create a
> suitable scope and compile a template, then I want the result to be
> displayed as a tooltip using ui.bootstrap's tooltip module.
>
> I've designed a plunker that does exactly that, but it's extremely tightly
> coupled with the specific controller and view. I want to be able to turn it
> into a directive.
>
> The plunker simulates a real world situation where I wait for 500msec
> after mouse-enter, then initiate an asynchronous load (which takes 5
> seconds), and then the tooltip is updated. The tooltip has 3 states:
> waiting (the first 500 msec when i'm not sure the user actually wants to
> see the tooltip, and I don't want to initiate the ajax request just yet),
> loading and loaded, it is evident from the plunker.
>
> Please have a look at the plunker
> <http://plnkr.co/edit/4vMsHYNlqxWXL0bQzoE6?p=preview> to see the details.
>
> Again, my goal is to convert this into something reusable, a module, a
> directive or both.
>
> 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.