-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix(tooltip): Transcludes contents to allow dynamic selector text #72
Conversation
A dynamic selector did not work as the contents of the directive element were not transcluded. This fix adds transclusion through a new directive controller method. It also includes a new test for this case (through an ngRepeat) as well as a modified demo to show this use case. Closes angular-ui#69
Landed as ab44a86. Had a look at the fix and wouldn't think of this :-) |
Isn't it easier just to use
in the directive definition and then
which is basically what this new directive controller does anyway? |
@petebacondarwin Actually, it's not transcluded into the tooltip popup; it's transcluded into the element on which the tooltip directive is applied. The tooltip-popup is only in the DOM on mouseover. The issue I was trying to solve was transclusion on an element that had no template (i.e. the tooltip directive). I agree with @pkozlowski-opensource that it feels overly-complicated. I also considered removing the isolate scope, but then I would have to include the $watch logic myself, so complexity increased either way, so I opted for code security complexity instead. But I'm sure there's a better way to do this. |
Thanks for getting a fix for this in so fast! Would you mind pushing it to https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.1.0-SNAPSHOT.js too? (What's the difference between that version and the one without tpls, by the way? Couldn't find that documented, sorry if I missed it.) |
@Skivvies just pushed demo & build updates to the As for the file naming we've got:
Files with the Now it should be clear that files with the |
Thanks @pkozlowski-opensource! Saw you added this info to the README in the gh-pages branch, nice. I also saw you pushed the fix in ab61230, but my plunkr (which points to http://angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.1.0-SNAPSHOT.min.js) doesn't seem to have been fixed by it, hm. |
@Skivvies The fix is in the gh-pages branch, but has not yet been pulled by Github Pages. This should fix itself pretty soon. |
@joshdmiller Normaly pages are built just seconds after the push... Maybe a cash refresh problem? |
@pkozlowski-opensource Indeed you're right. I wonder why Github is telling the browser the file is unchanged... |
@joshdmiller Thanks for that. I understand now. |
@petebacondarwin We are using a template, but just not for the primary directive. Right now, the popup does not have an isolate scope while the tooltip does; we could swap this, removing the isolate scope from the tooltip and therefore also the need to worry about transclusion, and add an isolate scope to the popup directive. It increases complexity, but it's probably more "correct". What do you think? |
I just tried the latest version with the example in http://plnkr.co/edit/1GiwHv locally and it's still broken for me. Would anyone be able to check if #75 is actually a duplicate of this issue, and if not, reopen? |
@Skivvies There is a typo in your Plunker. On line 17, you use "path" as the expression when it should be "url". Here's a corrected version: http://plnkr.co/edit/PNpdIg?p=preview. |
Oops, sorry for sending you a bad version! Here's the version I meant to send: |
A dynamic selector did not work as the contents of the directive element
were not transcluded. This fix adds transclusion through a new directive
controller method. It also includes a new test for this case (through an
ngRepeat) as well as a modified demo to show this use case.
My apologies for the earlier PR I closed. The bug fix was correct, but the test was useless. This new PR contains the better test.
Closes #69