Ответ 1
Да, вы можете, согласно @Mikke ответить. Подводя итог, существует четыре способа объявления связующих функций:
-
Внутри
compile
явно указывается как функцииpreLink
, так иpostLink
:compile: function compile(tElement, tAttrs, transclude) { return { pre: function preLink(scope, iElement, iAttrs, controller) { ... }, post: function postLink(scope, iElement, iAttrs, controller) { ... } } }
-
Внутри
compile
неявно возвращается толькоpostLink
:compile: function compile(tElement, tAttrs, transclude) { return function postLink( ... ) { ... } }
-
Внутри
link
явно указывается какpreLink
иpostLink
:link: { pre: function preLink(scope, iElement, iAttrs, controller) { ... }, post: function postLink(scope, iElement, iAttrs, controller) { ... } }
-
От использования
link
с помощьюpostLink
неявно:link: function postLink( ... ) { ... }