-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Closable tabs #166
Comments
For the close button markup, you can probably use the BS markup used on the close button of alert <button type="button" class="close">×</button> It comes with hover styles as well. |
@bekos Closable is not a bad idea, it could work as in the alert directive. The problem, though, is with static tabs. We would have to dynamically remove DOM and this makes me feel uneasy. Feel free to play with the idea, on our side we need to merge other, existing PRs first. |
Why not just use ng-repeat and splice the tab from the array? |
@ajoslin This way i have to provide a custom template in order to show the X button for a simple fetaure that is provided by default in other libraries like Jquery UI and also we must find a way to handle static tabs which don't exist in the controller's scope array. By the way, playing around with this, i have a problem when removing the div (content) element from a static tab, this triggers the destroy event for every pane. Any idea why this is happening? |
I don't know if i should open a new issue, but while working with tabs, i feel that the support for static tabs makes things a bit confusing. For example, lets say i want to display first a static tab, some dynamic tabs based on some preferences then, and a lastly another static tab. Then, simply thinking (not an expert in angular), i would write in my HTML something like this:
< tabs >
< pane heading="Static title">Static content
< pane ng-repeat="pane in panes" heading="{{pane.title}}" active="pane.active">{{pane.content}}
< pane heading="Last Tab">Static content 2
< /tabs >
But the actual output is first all the static tabs and then all the dynamic ones (it 's obvious :-) ). So, I think that using angular just for html encapsulation is bit of abusing, and the way it should go, is to force users to use scope objects to define all their entities. So, in my opinion again, a syntax like:
< tabs panes="panes">
...Probably here some HTML elements that we want as contents in some elements... (not necessarily)
< /tabs>
and the controller |
We are working a For your case it would look like: <tabs>
<pane ng-repeat="p in panes">
<pane-heading>
{{p.title}} <a ng-click="removePane(p)">[x]</a>
</pane-heading>
{{p.content}}
</pane>
</tabs> |
Has #151 really been merged? What would be the syntax to add icons to the tab header now? |
It 's not merged yet. There will be no specific syntax for "close" icons, but you will be able to write vanilla HTML inside your |
All these issues are solved in the same way. This one started as an idea to provide a default close icon like the way we do in |
++ to final choice. I'll add a delete icon instead of close icon and delete a model instead of just close it. |
Add support to disable search feature.
I think most of the applications need the ability to close a tab with an x square in their top-right corner.
So, a possible implementation should expose the
removePane
method to the $scope and the template should use anng-show
on aclosable
attribute from the pane to display or not the X button.The problem here, is that Bootstrap's CSS does not support close buttons in tabs out of the box. So we need to style this button inline or provide another CSS file to change on hover the button's color , opacity, cursor etc
Thx
The text was updated successfully, but these errors were encountered: