Hi Everyone, I'm following MVC architecture in Angular to organize my code. I have model which maintain the state of the system and then I have services used by models to retrieve data from remote server. And then I have controllers. Now every time model requests some data from service, service returns a promise object which will be resolved later in time. Success and failure handlers for promise would be something like this: promise.then(fnS, fnF);. My confusion here is should I attach the success and failure handler to promise in Model itself(on success, let model change data that would be reflected in controller) or should I pass the promise to controller and let controller attach the success and failure event listener. As per my understanding, controllers have logic related to user input and interactions.
During codereview, I got this feedback that I should attach success and failure handlers in controller as their may be cases when the model object is shared between two controllers and then if the calls fails, respective controllers won't have the flexibility to act in different ways since the success handler is already attached in model. I'm new to angular. -- 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.
