A
A
Artem Shchurin2015-06-11 09:08:54
Angular
Artem Shchurin, 2015-06-11 09:08:54

How to write a directive in angular?

Hello!
I’ve been working with Angular not so long ago, apparently I didn’t catch something from the basic concepts
. I created a directive that hangs events on table elements.
I open the table for the 1st time, the view for the table is loaded, my directive works, events are hung, callbacks are called. I close the
table:

ng-show='false'
ng-include=' '

I open it again, this is where the strange thing starts for me:
the variable in the model that is associated with ng-show is set to true, ng-include gets the path to the view
in the document tree, markup appears
, my directive code is called, events are added to the necessary elements, but in As a result, they are not called, this is a mystery to me.
The only difference between the first and second (+ all subsequent) calls to the table is that the element still has the ng-hide class, plus the template is loaded only for the 1st time
. Why can this happen?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentin Dubrovsky, 2015-06-11
@matroskin13

did not quite understand the question without an example, but try replacing ng-show with ng-if

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question