我需要一个用于Angularjs应用程序的表,所以尝试使用来自http://ui-grid.info/docs/#!/tutorial/101_intro的UI网格,但出现问题并且控制台显示出这样的错误:
你可以检查代码吗未捕获错误:[$ injector:modulerr]由于以下原因,无法实例化模块appModule: 错误:[$ injector:modulerr]由于以下原因无法实例化模块ui.grid: 错误:[$ injector:nomod]模块'ui.grid'不可用!您要么错误拼写了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。
//index.html
<body>
<app></app>
<script src="dist/bundle.js"></script>
</body>
// app.html
<table-transaction></table-transaction>
//table-transaction.html
<div ui-grid="{ data: GridController.transactions }" class="table-transaction-grid" ></div>
//index.scss
@import "~normalize.css";
@import "~angular-ui-grid/ui-grid.css";
@import "./components/table-transactions/table-transactions";
//table-transaction.scss
.table-transaction-grid {
width: 100%;
height: 250px;
}
//index.js
import "./index.scss";
import angular from "angular";
import { appModule } from "./components/app/app";
angular.bootstrap(document.body, [appModule]);
//app.js
import angular from "angular";
import template from "./app.html";
import { tableTransactionModule } from "../table-transactions/table-transactions";
export const appModule = angular
.module("appModule", [tableTransactionModule, "ui.grid"])
.component("app", {
template
}).name;
//table-transaction.js
import angular from "angular";
import template from "./table-transactions.html";
export class GridController {
constructor() {
this.transactions = [
{
date: "01.03.2018",
amount: "-300 USD",
description: "soccer playing",
tags: hobby,
account: XBank,
debitcard
},
{
date: "17.03.2018",
amount: "+1500 USD",
description: "%% deposit",
tags: "YBank's services",
account: deposit
}
];
}
}
export const tableTransactionModule = angular
.module("tableTransaction", [])
.component("tableTransaction", {
controller: GridController,
template
}).name;
答案 0 :(得分:0)
好像你需要导入ui-grid.js