T
T
ttm2015-05-12 22:21:57
Angular
ttm, 2015-05-12 22:21:57

Internal module, creates 2 scopes?

Please help the great Gurus, I have already spent a lot of time on this.
An easy example is jsfiddle.net/zggwx567/10
For some reason, the directive from the module is compiled first - "my-dir" ,
then - "my-directive" , and then because "my-directive" is compiled again - "my -dir"
2 clicks in a row occur - how to fix this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-05-12
@TouchTheMind

I don't know why you didn't use the ngRepeat + ngTransclude combination to solve the original problem, but oh well.
And the click happens twice because first your directive was processed by Angular and then you compiled this thing again. That is, you did not just compile, but did it with the same piece of DOM, so that everything was duplicated. One of the options is to make a clone of the elements and then compile. Well, or remove manual compile from myDirective, it is not needed there. And if you need it, it's better to replace it with ngTransclude.

T
ttm, 2015-05-13
@TouchTheMind

Solution http://jsfiddle.net/zggwx567/11/ - for those who are interested.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question