首页 > 解决方案 > AngularJS 1.7 - templateUrl 在视图中显示 url 而不是模板

问题描述

概括

我正在尝试将我的 angularjs 组件/指令转换为 TypeScript。不幸的是,该templateUrl属性不显示传递给它的模板。相反,它实际上显示了模板的部分路径。

代码

class JumpPagerController {
...
    }
}

JumpPagerController.$inject = ['$timeout'];
export const jumpPagerComponent = {
    templateUrl: './jump-pager.component.html',
    controller: JumpPagerController,
    bindings: {
        pagerPlaceholder: '@?',
        pagerCurrentPage: '=',
        pagerItemsPerPage: '=',
        pagerTotalItems: '=',
        pagerChange: '&'
    }
};

预期的

在此处输入图像描述

实际的

在此处输入图像描述

我试过的

回顾

所以你可以看到我不知所措。使用 typescript 和 webpack 在 angularjs 组件上使用 templateUrl 的正确方法是什么?

标签: angularjsangularjs-components

解决方案


推荐阅读