This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
Options not applied within transcluded directive #123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I came across an issue where a wrapping directive within a transcluded directive would not be able to set
ui-ace
options. After stepping through the code, I found out the following:When
uiAce.link()
is executing, the value ofscope.$eval(attrs.uiAce)
wasundefined
. However, when thescope.$watch(attrs.uiAce)
was executed for the first time, the value was properly set to the expected object. However,ui-ace/src/ui-ace.js
Line 279 in 4ce0309
$watch
, leaving us just the default options.The proposed fix removes that short-circuit (which was not a performance issue in my testing). It also fixes the first call of
updateOptions
, which erroneously usedoptions
instead ofopts
.By the way, in my testing, the directive wroks as expected without that
updateOptions
call when the short-circuit is removed. However, the tests fail. It seems like the tests are in the wrong here - they should probably wait a digest cycle before doing their assertions on the Ace Editor options.