Angular Hapi/Inert 上未加载

Angular not loading on Hapi/Inert

我正在尝试使用 Hapi 17 构建一个非常简单的 Hapi / Angualr 页面。

我有一个基于 Angular 的简单 index.html,它从控制器中的数据集中填充两个标签

<div ng-app="myApp" ng-controller="myCtrl">
    <label>
        {{ hello }} {{ world }}
    </label>
</div>

当我 bootstrap 来自 Webstorm 的索引页面时,绑定按预期工作。

我已经设置了一个非常简单的 Hapi / Inert 服务器来做服务器 index.html。该页面按预期加载原始 HTML,因此这方面的工作正常。

不过 当我加载页面时,Angular 绑定仅显示原始文本,即。 {{ hello }} {{ world }}

有个笨蛋here

事实证明我使用了惰性文档中错误的 server.route 定义。

单文件路由(下)看不到包含 angular 应用程序定义的 javascript 个文件

server.route({
    method: 'GET',
    path: '/{path*}',
    handler: {
        file: 'page.html'
    }
});

移动到以下示例,并将 front-end 文件移动到 "public" 文件夹,使其工作

server.route({
        method: 'GET',
        path: '/{param*}',
        handler: {
            directory: {
                path: '.',
                redirectToSlash: true,
                index: true,
            }
        }
    });