Angular 8打字稿文件替换错误

问题描述

我正在使用 angular.js 配置替换html文件,但是如果我需要从组件中替换打字稿文件,则会显示错误。我正在使用角度8。

angular.js

import React,{ useState,useEffect,useRef } from "react";
import { useSelector,usedispatch } from "react-redux";
import Paginate from "react-paginate";
import { loadDataTable } from "../../actions/index";

const TabularListPagination = () => {
    const dispatch = usedispatch();
    const dataTable = useSelector((state) => state.dataTable);

    useEffect(() => {
        attachShortcutEvent();
    },[]);

    const attachShortcutEvent = () => {
        document.addEventListener("keydown",(event) => {
            if (event.altKey && event.key === "ArrowLeft") {
                if (dataTable.current.current_page !== 1) {
                    dispatch(loadDataTable(dataTable.current.current_page - 1));
                }
            } else if (event.altKey && event.key === "ArrowRight") {
                if (dataTable.current.current_page !== dataTable.current.total_pages) {
                    dispatch(loadDataTable(dataTable.current.current_page + 1));
                }
            } else if (event.altKey && event.key === "Home") {
                dispatch(loadDataTable(1));
            } else if (event.altKey && event.key === "End") {
                dispatch(loadDataTable(dataTable.current.total_pages));
            }
        });
    };

    return (
        <Paginate
            containerClassName="pagination"
            forcePage={dataTable.current_page}
            pageCount={dataTable.total_pages}
            marginPagesdisplayed={2}
            pageRangedisplayed={5}
            onPageChange={({ selected }) => {
                dispatch(loadDataTable(selected + 1));
            }}
            nextLabel="&gt;"
            prevIoUsLabel="&lt;"
        />
    );
};

export default TabularListPagination;

错误

"production": {
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",// GOOD
      "with": "src/environments/environment.prod.ts"
    },{
      "replace": "src/theme.css",// GOOD
      "with": "src/theme.prod.css"
    },{
      "replace": "src/app/login/login.component.html",// GOOD
      "with": "src/app/login/login.component.prod.html"
    },{
      "replace": "src/app/login/login.component.ts",// ERROR
      "with": "src/app/login/login.component.prod.ts"
    }
  ],

我在“ prod”和“ normal”文件中有这个 component header

ERROR in : Cannot determine the module for class LoginComponent in /src/app/login/login.component.prod.ts! Add LoginComponent to the NgModule to fix it.

有没有一种方法可以替换组件中的打字稿文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)