I think that the controller should bring the data to view from model. However, is it controller's duty to tell how view should display the data, or the view should know how the data should be displayed?

To be more specific, I am writing a website, there are several databases as data model, the controller is written in Python, and view is written in AngularJS.

Now, on the view side, where should I code how the data is displayed, on the JavaScript side or on the Python side? E.g. I maintain a JSON file:

  "key": "name",
  "column": "Name",
  "align": "left"
  "key": "salary",
  "column": "Salary",
  "align": "right",
  "filter": "salaryFilter"

Should it be stored in personInfo.js, or personInfo.js should read it from controller via ajax?


The tradition of MVC is that the View decides how data is displayed.

If you are writing view with Angular in a browser then you will need HTML for your view. The view will be a combination of HTML and angular directives. Any decent Angular tutorial will show you this quickly.

Angular is based on the idea that there will also be a controller and model in javascript. It would be typical to have model, view, and controller in javascript and HTML (for the view) on the client side.

You can have a server side MVC framework. There are many. But it would seem odd to have a view on the server side if you are building your UI with Angular.

You might also have a view on the server side if you support some other form of UI, such as voice response, PDF output, virtual reality, character mode terminal, that is not built with angular in the browser.

And you would have a server side view if you dropped Angular and used, say JSP or PHP to produce your UI.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.