Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Issues with ng-if and inputs #22

Open
ederuiter opened this issue Mar 10, 2015 · 7 comments
Open

Issues with ng-if and inputs #22

ederuiter opened this issue Mar 10, 2015 · 7 comments

Comments

@ederuiter
Copy link

When using ng-if in combination with multi-transclude weird things can happen with inputs. I created a fiddle to reproduce the issue:

http://jsfiddle.net/v9kvfo73/3/

The first label / input is the one with multi-transclude, the second one is with the standard ng-transclude.
Both have a div with an ng-if around the transcluded block.

When updating one of the inputs I expect the form to become dirty and the save button should be enabled. This works as expected for the standard ng-transclude, but not for the one inside the multi-transcluded block. Updating the first text box doesn't even clear the pristine state of the text box itself.
However updating the second text box will also update the first text box. So it seems the binding has become one-way ..

@zachsnow
Copy link
Owner

Thanks for the report I'll check it out.

@davecap
Copy link

davecap commented Mar 24, 2015

We had a similar issue, but it seems to be fixed in a previous version (0.1.2).

@jercoh
Copy link

jercoh commented Mar 24, 2015

It seems to happen from version 0.1.4 (works in 0.1.3 and under).

@zachsnow
Copy link
Owner

Thanks @davecap @jercoh.

@zachsnow
Copy link
Owner

In fact using multi-transclusion in this way won't work: we perform the transclusion eagerly, not upon each occurrence of ng-multi-transclude. Probably we will need to entirely rethink how the module works to allow this usecase. Ideally we would compile each block separately and link them only when the corresponding ng-multi-transclude is linked.

@sloosch
Copy link

sloosch commented May 9, 2015

Hi zachsnow,
Thats exactly how i've done it with https://github.com/sloosch/decl-transclude . My simple module doesn't rely on $transclude instead it uses the compile-phase of a directive to get the templates and their names to later transclude and put it back together via $compile in the link phase:

<div some-directive decl-transclude> //grabs the content of the element in the compile phase
    <div decl-transclude-as="foo">bar</div> //declares a transclude with a name - will be grabbed by decl-transclude
   ....
</div>
//inside some-directive
<div class="some-directive">
...
    <div decl-transclude-from="foo"></div> //compiles the grabbed content in the appropriate scope
....
</div>

@zachsnow
Copy link
Owner

Hey @sloosch, very cool, I look forward to checking it out!

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

No branches or pull requests

5 participants