The angular instruction is executed twice with different attribute values

in the business, an angularJS instruction is written,
html:

 <ss-menu-directive search-mode="false"></ss-menu-directive>

JS:
console.log (attr.searchMode) in the link function;
print result:

there are two questions: why does the link function execute twice? Why do you get the value of the attribute twice, get the false, once, and undefined? the second time?
A novice, if the problem is shallow, I beg your pardon, thank you!

Mar.06,2021
Menu