2017-02-16 81 views
1

我想使用spring引导来使用AngularJS应用程序(使用嵌入式tomcat服务器)。当我通过请求index.html来提供应用程序时,每件事都可以正常工作。 ,但我想直接与index.html一起提供所需的视图。如何使用Spring引导服务AngularJS应用程序的意见?

例如,

如果我有像view1.html, view2.html(div elements)以及这些视图中的一个多个视图可以被包括在的index.html。我想创建使用springboot应用控制器,可以直接与view1.html or view2.html根据URL模式加载index.html映射..

(\pattern1 -- will load the index.html along with view1. 

html and \pattern2 -- will load the index.html along with view2). 
+0

您是否在使用某种Angular路由器,如ui-router? –

+0

是的......但我想直接提供一个特定的视图作为index.html的一部分取决于url模式。 –

回答

1

你可以从角的东西,如读你的网址:

$routeProvider.when('/view1/:param1/:param2', { 
    templateUrl: 'view1.html',  
    controller: 'MyCtrl1' 
}); 

所以根据您的网址,模板在您访问视图时发生变化。 当然,您可以通过$ stateProvider通过“状态”来管理它。

相关问题