-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Conversation
Don't know if the comment still applies with current changes and the used of specific ui-select-* clasess to help access those elements later? |
</a>', | ||
templateUrl: function(tElement, tAttrs) { | ||
//Gets theme atribute from parent (ui-select) | ||
var theme = tElement[0].parentElement.getAttribute('theme') || uiSelectConfig.defaultTheme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use attributes to pass information between directives. Place a controller property on uiSelect
, and then use require: '^uiSelect'
on the children directives. The object references will be the same, so anything you attach as a property of the controller function/object will be accessible through the injected controller on children.
Only catch might be I'm not 100% what the earliest phase you can access the controller (compile > controller > link vs controller > compile > link, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the approach I wanted initially, but I cannot access the parent controller from template function at child directive, so the only way I could was like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... I might suggest just using a plain string and rethinking it later. I don't think that something like this should be toggled arbitrarily because people do not want to pass a theme parameter in their DOM. The only time you WOULD is if you want a specific instance to look a little different, but in that scenario it SHOULD be something they're capable of doing with the transclusion.
TL;DR:
I recommend dumbing down our code and just making this a string (can be based off uiSelectConfig)
var transMatch = uiSelectElements.byClassName(transcluded[0],'ui-select-match'); | ||
var transChoices = uiSelectElements.byClassName(transcluded[0],'ui-select-choices'); | ||
uiSelectElements.byClassName($elm[0],'ui-select-match').replaceWith(transMatch); | ||
uiSelectElements.byClassName($elm[0],'ui-select-choices').replaceWith(transChoices); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seams there's a bug:
Sometimes choices.tpl.html
template is downloaded AFTER select.tpl.html
, when this happens the choices list and the main directive are never plug together, so choices are never shown. I guess we could solve this by specifying priorities to the directives (I'll need to check this)
@ProLoser I don't feel right having third party css on the |
@dimirc ideally we want to be able to merge ui-typeahead into this project. DO you think you could add a demo for that too? That to me is an important goal because I don't want to have 3 separate plugins anymore. |
@ProLoser what do you mean with "merge ui-typeahead" and what will the demo be about? |
Add a theme so that we can demonstrate that you can use ui-select instead of ui-typeahead. It should behave and look almost the same. I want to remove ui-typeahead from ui-bootstrap and remove ui-select2 so that we can all merge efforts. |
I did some refactor with changes that seam like a better approach, the main modifications are:
|
@ProLoser what's your idea about removing all third party css (selec2, selectize, etc) from |
I'm not opposed to that. Are you saying that the instructions would also show you how to specify the proper html? |
@ProLoser what do you think about merging the changes on this PR to master and branch from there for next changes? |
@dimirc you don't need my permission, you call the shots. The branch looks good to me. |
@ProLoser ok, good... lets go crazy then 👍 |
+1 |
PS: I mean't the branch looks good to merge to me. |
As discussed on #8 I created a separate folder for theme "select2" with css and all related templates
Right now I'm using some clases to 'flag' some elements:
<choices>
<match>