-
Notifications
You must be signed in to change notification settings - Fork 355
Conversation
Added uiTabs directive that add twitter bootstrap style tabs for each direct child of decorated element.
@typesafe There is already a directive for tabs in the boostrap repo: https://github.com/angular-ui/bootstrap/blob/master/src/tabs/tabs.js Could you elaborate on how your implementation is different / better? |
OK, totally missed that one! Wouldn't have started this if I had known... Anyway, since you asked: My version does not rely on templates and explicit elements, instead it applies behaviour to any element and its children by providing a definition object (which is extended and exposed through the current scope). |
There are a couple of ways I could think of suggesting improvements, but before that should we close this PR and consider instead moving this to bootstrap? @typesafe a few of my concerns: I have thought about doing tabs using an object definition, but this only seems to serve to obfuscate things needlessly. Having Instead, the only tedium becomes adding click events, keeping track of which tab is open and adding some sort of 'active' class. If I was developing a tabs directive myself from scratch, I might instead focus on solving those issues alone. Something like
Repeaters, conditionals, and other such nonsense could then be handled as developers see fit. Of course the elegance of this solution could also be disputed when it comes to something like changing the active tab programmatically or from outside the traditional controls. |
+1 for closing this one and focusing on what we've got in the bootstrap's repo. What we've got in there is already using templates so people could customize look & feel if needed. I also do agree with @ProLoser that using object literals is not necessarily better over using plain old HTML. If one looks for cutting down number of characters to type there is always option of Jade or something similar. |
(@pkozlowski-opensource, you beat me by a few minutes in responding, but I'm gonna leave it as is) Thanks for your feedback. Indeed, I agree, the definition object is probably not the best idea and delegating the creation of it to a controller is even worse. Going over this again this a bit, I think that something like the following would be a nice improvement:
Optionally, one could name the tabs by providing ids...
...and indicate the initially active tab
Adding a
But I'm getting carried away :-). Anyway, this PR was the result of me being a bit over-enthousiast (I hadn't even noticed the bootstrap repo!). So I totally agree that it should be closed. I'm not sure if it should be moved over to the bootstrap repo, through. I think it's more important to aim for consistency that is in line with the overall philosophy of the project, which I'm not familiar with (yet)... Like I said before, I wouldn't have started this if I had known bootstrap already had it. |
@typesafe Thnx for your constructive approach, it is a pleasure to see your comments! And above all, please do have a look at tabs in the bootstrap repo! What we are trying to do is very similar to what you have been proposing here, that is:
Having the ability to select a tab from a controller would be awesome, I've started to look into this a bit (same for accordion). So please, if you've got any suggestions / improvements / PRs don't hesitate to contribute in the boostrap repo! Your input / contributions will be very valuable, I'm sure of it! |
I've added a uiTabs directive that allows you to add and control tabs with minimal effort.
View the README (https://github.com/typesafe/angular-ui/blob/master/modules/directives/tabs/README.md) for more details.