与Apache瓷砖AngularJS [英] AngularJS with Apache Tiles

查看:165
本文介绍了与Apache瓷砖AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Spring MVC和AngularJS为我的项目。可以AngularJs的 $路由并ngView被用来代替阿帕奇瓷砖框架在一起吗?至于我可以看到使用$路由和ngView我们创建模板,并在singlePage应用程序中重用它们。

I use Spring MVC and AngularJS for my project. Can AngularJs $routing and ngView be used instead of or together with the Apache Tiles framework? As far as I can see using $routing and ngView we create templates and reuse them in a singlePage application.

推荐答案

是,AngularJs'路由可以使用,而不是瓷砖。您也可以后,可能爆发singlepage应用创意在一起使用,但

Yes, AngularJs' routing can be use instead of tiles. Also you can use together, but after it may broke singlepage app idea.

在瓷砖,你可能使用的JSP文件。所以JSP文件编译在服务器端,并通过浏览器客户端作为HTML文件。

In tiles you probably use jsp files. So jsp files compiling in server-side , and serving as html file in client side via browser.

在角也可以创建基地布局。而像地砖'布局延长能力强,具有 NG-包括您可以包括你的其他观点的 NG-视图 HTMLS。而当路线另一页NG-视图将刷新包含的区域(也有论it.Take AngularJs一看的 UI路由器。它提供了很好的嵌套视图)。

In angular also you can create base layout. And like tiles' layout extend ability , with ng-include you can include your other views your ng-view htmls. And when route another page ng-view will refresh included area(Also there are some third party plugins/frameworks on AngularJs about it.Take a look ui-router. It provides nice nested views.).

在角方式常用无需从服务器端获取HTML(这种情况可能会根据其他情况的变化。为了使singlepage没有必要)。所以,你需要转换你的控制器返回的ModelAndView 对象地图(作为一个例子)返回 JSON 。此时路由将由angularJs'路线来实现。这些重构后,你将有一个singlepage应用。或者你可以让混合singlepage (有些页面有太多的事件,这样你面包车开始与该网页,使单页,以减少工作量),所以它会显示工作量取决于你应用程序的大小。

In Angular way commonly no need to get html from serverside(this situation may change depending on the other situations. To make singlepage no need.). So you will need to convert your controllers which returns ModelAndView object to Map(as an example) to return json. At this time routing will be achieved by angularJs' routes. After these refactorings , you will have a singlepage application. Or you can make hybrid-singlepage(some pages have too many event so you van start with that pages to make single page to reduce workload) So It will reveal workload depends on your application's size.

这篇关于与Apache瓷砖AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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