0

I have worked with MVC on the back-end (Rails), and am currently working with MVC(MV*) on the front-end (Angular). I have seen Angular as considered an MV* pattern, but why is it considered that exactly?

Using Angular, I understand the separation of concerns, with Views (templates), Controllers, and use Services to serve up data. In this case, the model (data store) via ng-model makes sense for front-end temporary storage, but the actual persistence (when a POST or PUT is made to an API) seems to be the wildcard. As the way data can be persisted, could be handled differently (database, firebase, etc..).

It seems to me that *VC is more appropriate based on my understanding, as Controllers in Angular are better defined than Models.

There must be something core about the MV* pattern that I am missing or confused about, any clarification is greatly appreciated.

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • Models can be stored locally using [localStorage or sessionStorage](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage), or they can be stored server-side via AJAX. Which one is used is up to the developer. – Blazemonger Oct 02 '14 at 16:56
  • Persistence has absolutely nothing to do with MVC. There clearly is a model in AngularJS, which is separated from the view. Compare this with a jQuery-based app, for example, where the model is the DOM itself, which is also the view. – JB Nizet Oct 02 '14 at 17:22
  • @JBNizet ok persistence having nothing to do with MVC, now makes sense when you say it that way. But I am still curious as to why MV* when there clearly is a controller. – user3761685 Oct 02 '14 at 18:00
  • AFAIK, AngularJS defines itself as an MVC framework. See https://docs.angularjs.org/api/ng/directive/ngController for example. – JB Nizet Oct 02 '14 at 19:12

1 Answers1

1

Here are a few ways * can be chosen in Angular:

Important thing is that UI and Models are the common denominator. Build interesting UI without breaking app and build interesting business logic without breaking UI.

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265