I just couldn't wrap around my head which way is the correct one and couldn't find a straight forward answer sooo... :) I have the data being pulled from a server api and that data is used inside a directive. Problem is that with promises I have to setup watches inside directives otherwise I get undefined data... Why should I pass it from the controller and not just use the service inside the directive itself? But then the controllers would be left empty. So if they are meant to bind data what does that exactly mean? I mean all the data could just be pull straight inside directives and they would handle everything, like components.
Asked
Active
Viewed 32 times
0
-
Is it correct if I just view the controller function as a top level directive which should only handle what is on the top level? – MattJ Oct 23 '16 at 23:12
-
1That's correct. In well-designed app there may be no `ng-controller` controllers at all. – Estus Flask Oct 24 '16 at 00:26
-
Thanks! :) needed this confirmation :) – MattJ Oct 24 '16 at 00:34