Вопрос

Is it possible for 2 directives to use the same linking function? They have different templates but are otherwise the same. They don't require each other so I don't want to use transcluded / require. Any ideas?

Это было полезно?

Решение

Create a factory/service which implements your logic and inject it in both directives. Call it in both link functions. Done.

Другие советы

you really don't want to do this as directives create their own scope once isolated. also they have their own element, attrs values to pass on.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top