Hello, i'm looking for best practices on services, controllers and directives for Angularjs 1.3.X.
*Here is the rules i noticed :* - The view (html) knows only the main controller and his scope - A directive should not have his own services *So :* - The view (html) cannot call the services directly. - The view (html) must use the main controller to access the services. - The view must declare the binding between the directive and the main controller *And then :* In the code, if a directive have to call a business function F1 of services : - the main controller must publish a function F2 which wrap the function F1 - the view must declare F2 in the directive configuration You can look at the picture attached for a more visual explaination. *Questions :* - Are you agree with those rules and the style of code ? - Do you have any additional rules ? - Why should we not follow these rules ? <https://lh5.googleusercontent.com/-00p2vadZ7KY/VG9Ccpi7FKI/AAAAAAAA5mE/Cvp0PRdyCF0/s1600/archiAngularjs.png> -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
