Closed damienwebdev closed 8 years ago
I'm not familiar with what you're referring to. Could you explain more or link me to an example of this new syntax that you mentioned?
Hey Ahmed, I actually submitted a pull request to the fork of the repo by Matt grande. I would take a look at that for an example.
Edit: Figured I should add the link to the pull request... https://github.com/mattgrande/angular-joyride/pull/1
On Oct 7, 2016 6:14 AM, "ahmed-wagdi" notifications@github.com wrote:
I'm not familiar with what you're referring to. Could you explain more or link me to an example of this new syntax that you mentioned?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ahmed-wagdi/angular-joyride/issues/2#issuecomment-252206827, or mute the thread https://github.com/notifications/unsubscribe-auth/AInIFoJ0CbWqX76ilWhll02xovyUcCMuks5qxhuPgaJpZM4KPdPB .
Ok thanks i will look into implementing it.
Any idea what are the benefits of using $templateRequest instead of $templateCache.get that i'm currently using?
Request, as far as I'm aware allows you to request an external template. So, as opposed to having to store the html of the joyride component in the same file and access via the ID, you can access it via a URL, allowing it to sit in its own file, which makes it a little more reusable. I don't think template cache does that, it can only store the element, not go and request one via async. The issue I ran into with that PR is that it returns a promise, so the rest of the code has to wait, but I couldn't figure out how to do so.
On Oct 7, 2016 11:42 AM, "ahmed-wagdi" notifications@github.com wrote:
Any idea what are the benefits of using $templateRequest instead of $templateCache.get that i'm currently using?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ahmed-wagdi/angular-joyride/issues/2#issuecomment-252286879, or mute the thread https://github.com/notifications/unsubscribe-auth/AInIFl4_epxpf2TZhGU722pAgFC9JFEdks5qxmh0gaJpZM4KPdPB .
yes you have to access the response of the promise using .then(), so to get to the template you would have to do:
$templateRequest(templateName, true).then(function(response){ template = response; });
That being said there are still other parts of the directive that need to be rewritten to get this to work correctly so i'll look into it.
Done, templates are now fetched using $templateRequest instead of $templateCache.get
It'd be nice if we could utilize the templateUrl syntax of angular 1,5,. If this is already possible, I dont see it documented anywhere.
Cheers!