ng-include找不到我的页面

时间:2016-01-20 10:17:46

标签: angularjs path angularjs-ng-include

我的所有网页都在 / WEB-INF / views / 下。我使用ng-include在index.html中包含一个页面

 <div ng-include="'myPage.html'"></div>

但我得到了

  

获取http://localhost:8080/myPage.html 404(未找到)

这是我的configureViewResolvers:

  @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setPrefix("/WEB-INF/views/");
        viewResolver.setSuffix(".html");

        registry.viewResolver(viewResolver);
    }

1 个答案:

答案 0 :(得分:0)

确保ng-app之前或之外ng-include <div ng-app="" ng-include="'WEB-INF/views/myPage.html'"></div>  ,或者像

一样
{{1}}