Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

fix: make compatible with Angular 1.5 and non-cached templates #1430

Merged
merged 1 commit into from
Feb 12, 2016

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Feb 12, 2016

In Angular 1.5, transcluded content is linked lazily.
For uiSelect that means the clone in the transclude function is not compiled and linked yet, so
uiSelect cannot detect the match and choices elements by their classnames, because they haven't been
set yet (which happens by replacing the elements with the templates).
However, the templateUrl function is executed at this point, so we can use it to add the
class names to the directive elements.

On another note, this behavior also affected versions earlier than 1.5.0-beta.2, when the template
of ui-select-match or ui-select-choices wasn't cached. In that case, the async compilation of
the template would mean also that the clone in the transclude function wasn't compiled yet, and so
the classes wouldn't be set either.

Closes #1422
Closes #1356
Closes #1325
Closes #1239

@Narretz
Copy link
Contributor Author

Narretz commented Feb 12, 2016

@aaronroberson This fixes ui-select with angular 1.5. Can you please review / merge this? It seems to affect lots of people.

In Angular 1.5, transcluded content is compiled lazily.
For uiSelect that means the clone in the transclude function is not compiled and linked yet, so
uiSelect cannot detect the match and choices elements by their classnames, because they haven't been
set yet (which happens by replacing the elements with the templates).
However, the templateUrl function is executed at this point, so we can use it to add the
class names to the directive elements.

On another note, this behavior also affected versions earlier than 1.5.0-beta.2, when the template
of ui-select-match or ui-select-choices wasn't cached. In that case, the async compilation of
the template would mean also that the clone in the transclude function wasn't compiled yet, and so
the classes wouldn't be set either. This might be the cause of the error described in issue angular-ui#224.

Closes angular-ui#1422
Closes angular-ui#1356
Closes angular-ui#1325
Closes angular-ui#1239
aaronroberson added a commit that referenced this pull request Feb 12, 2016
fix: make compatible with Angular 1.5 and non-cached templates
@aaronroberson aaronroberson merged commit b1c4fdc into angular-ui:master Feb 12, 2016
@aaronroberson
Copy link
Contributor

@Narretz Thanks!

@adarshbhat
Copy link

Thank you, @Narretz ! 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants