0

I have three links and three controllers for each three link.

But, same HTML page need to show. Just need to process (in controller) and reload that page on each click of that link.

If I create directive to separate logic into directive JS/html then, problem is, how to reload the directive from controller ( shared scope is not work as , need scope object updated value at LINK function and not in html).

one option is - keeping watch flag in directive and reload based on it.

can any one suggest , some right approach in angular for same, do I have to keep one html page and different controllers OR directive to include in separate HTML page and reload directive from controller through watch ?

dsi
  • 3,199
  • 12
  • 59
  • 102
  • an idea is to pass a method to reload, from directve, and called any time is needed into controller – Álvaro Touzón Feb 03 '17 at 08:17
  • need to reload directive from controller. so, it not work. Logic is within directive JS but, request come from controller to reload. all html page has only one element - directive. – dsi Feb 03 '17 at 08:19
  • watcher would be fine ? – dsi Feb 03 '17 at 08:29
  • How to call method of directive from controller. – dsi Feb 03 '17 at 08:39
  • in directive scope definition pass a method of controller, and redefined into directive, is an idea because in javascript anythig goes by reference, and in directive will re-asing functionality – Álvaro Touzón Feb 03 '17 at 08:42
  • that will works first time. but post to that, request again come from controller then, directive not known to call controller method again. – dsi Feb 03 '17 at 08:57
  • the directive create the method with nothig, and passed to directive scope definition(html inyection), in directive is filled all the logic of this meths overwritten with same name. And at last is called from controller. – Álvaro Touzón Feb 03 '17 at 09:23

0 Answers0