在javascript的前端Web应用程序(MVC)中应该有哪些组件以及组件应该如何相互通信 [英] In a Front End web app(MVC) in javascript what components should be there and how should components communicates with each other

查看:52
本文介绍了在javascript的前端Web应用程序(MVC)中应该有哪些组件以及组件应该如何相互通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在javascript中的前端Web应用程序(MVC)中应该有哪些组件以及组件应该如何相互通信。

除了模型,视图和控制器之外还需要什么额外的东西。

解决方案

MVC Web应用程序中的前端组件 - 可能javascripts,jquery,angular等都基于脚本文件,它们被放置在项目的一个文件夹中,并且通过.Layout.cshtml页面在页面中引用,或者通过将源位置放在页面中,可以使用特定页面引用它们。



如果你有很多自定义脚本文件和它们彼此相关,然后你需要按顺序放置它们(引用)它们将如何运行,即如果file1.js需要file2.js然后将file2.js的引用放在file1中.js。



在MVC框架中,前端没有任何额外的东西可以用模型,控制器或视图完成。所有脚本和服务(角度)应按顺序放置在视图中,以便根据文件的定义维护文件之间的关系。



希望这会帮助

In a Front End web app(MVC) in javascript what components should be there and how should components communicates with each other.
What extra things required other than model ,view and controller.

解决方案

Front-end component in MVC web app - may javascripts, jquery, angular etc. all are based on script files and they are placed within a folder within your project and are referenced in the pages either via .Layout.cshtml page or they can be referenced with a particular page by putting the source location in the page.

If you have a lot of custom scripts files and they are related to each other, then you need to put them (reference) in a order how they will function, i.e. if file2.js is required by file1.js then put the reference of file2.js in file1.js.

In MVC framework, for front-end nothing extra stuff to be done with model, controller or view. All the scripts and services (angular) should be placed in the view in a order so that relationship between the files are maintain in accordance with their definitions.

Hope this will help.


这篇关于在javascript的前端Web应用程序(MVC)中应该有哪些组件以及组件应该如何相互通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆