Communicating with sibling directives

后端 未结 6 547
余生分开走
余生分开走 2021-01-31 10:19

Goal: Create behaviors using directives with communication between 2 sibling elements (each their own directive).

A behavior to use in example: The article content is hi

6条回答
  •  清歌不尽
    2021-01-31 10:42

    I had the same issue with a select all/ select item directive I was writing. My issue was the select all check box was in a table header row and the select item was in the table body. I got around it by implementing a pub/sub notification service so the directives could talk to each other. This way my directive did not care about how my htlm was structured. I really wanted to use the require property, but using a service worked just as well.

提交回复
热议问题