1. You can use Promise to encapsulate the AJAX request, and then perform subsequent operations after receiving the result in the instruction. 2. You can directly use $watch in the instruction to check whether the correct data is returned, and then perform subsequent operations. However, it is recommended that $watch is only used to check the data update status and not perform other operations.
1. You can use Promise to encapsulate the AJAX request, and then perform subsequent operations after receiving the result in the instruction.
2. You can directly use $watch in the instruction to check whether the correct data is returned, and then perform subsequent operations. However, it is recommended that $watch is only used to check the data update status and not perform other operations.
It’s not clear what your requirements are. You just described a directive value-passing compilation problem
Tell us how to bind the data object to the DOM, use the instruction to get the data on the DOM, and then request the data in the controller