【问题标题】:Spring Boot with Thymeleaf and AngularJS ui-router带有 Thymeleaf 和 A​​ngularJS ui-router 的 Spring Boot
【发布时间】:2023-03-23 23:05:02
【问题描述】:

我正在尝试创建一个简单的 Spring Boot Web 应用程序。我在前端使用 Thymeleaf 和 A​​ngularJs。

一切正常,直到我尝试在我的应用程序中添加 ui.router。

下面是我的 app.config:

.config(function($stateProvider, $urlRouterProvider) {
             $urlRouterProvider.otherwise('/home');

                $stateProvider        

                    .state('home', {
                        url: '/home',
                        template: index1.html
                    })
})

当我运行我的应用程序时,部分“index1.html”未加载到 ui-view 中。

我收到错误,因为“http://localhost:8080/index.html 是错误请求”

据我了解,templateUrl 已磨损。请指导我做对。

【问题讨论】:

    标签: angularjs spring-boot angular-ui-router thymeleaf


    【解决方案1】:

    如果你想让 Angular UI 路由做路由,你需要创建一个 Spring Controller 接受路由,但返回 index.html。

    也许这个答案也可以提供帮助: Which spring view resolver plays nice with angularjs?

    article 也可以提供帮助。

    【讨论】:

      猜你喜欢
      • 2015-07-07
      • 1970-01-01
      • 2016-02-05
      • 2018-01-26
      • 2015-06-16
      • 2017-07-09
      • 2018-08-05
      • 2023-03-04
      • 2017-06-05
      相关资源
      最近更新 更多