Javascript 调用节点模块失败,错误为:错误:未捕获(承诺中):TypeError:无法读取未定义的属性“toLowerCase”
我正在VS2017上使用AngularJS和Typesctipt与ASP.Net核心模板。 我在我的一个网页中添加了ng2表 我的app.module.shared.ts 网格HTMLJavascript 调用节点模块失败,错误为:错误:未捕获(承诺中):TypeError:无法读取未定义的属性“toLowerCase”,javascript,angularjs,typescript,visual-studio-2017,asp.net-core-1.1,Javascript,Angularjs,Typescript,Visual Studio 2017,Asp.net Core 1.1,我正在VS2017上使用AngularJS和Typesctipt与ASP.Net核心模板。 我在我的一个网页中添加了ng2表 我的app.module.shared.ts 网格HTML <ng-table [config]="config" (tableChanged)="onChangeTable(config)" (cellClicked)="onCellClick($event)" [rows]="rows" [columns]="columns"
<ng-table [config]="config"
(tableChanged)="onChangeTable(config)"
(cellClicked)="onCellClick($event)"
[rows]="rows" [columns]="columns">
</ng-table>
我不能得到什么是例外
请帮助。筛选有问题。 打开浏览器的开发工具并重新加载 那就等一下 按下“捕获异常”按钮 它有助于捕获异常开始的位置。有时你会看到像你这样的信息,但问题出在不同的地方
我会写它作为一个评论,但没有足够的声誉请包括toLowerCase错误的上下文:在什么变量上使用它,你能证明这个变量是定义的吗?您的代码不包含toLowerCase,因此我无法将您的错误链接到您的代码。抱歉,运气不好:每当我尝试在vs2017中调试我的应用程序时,此问题都会出现在开发人员计算机中,部署后,它工作正常。此外,在调试时,它的CPU使用率高达100%。我不熟悉使用vs构建应用程序,但您不能作为本地主机在浏览器中运行吗?
<ng-table [config]="config"
(tableChanged)="onChangeTable(config)"
(cellClicked)="onCellClick($event)"
[rows]="rows" [columns]="columns">
</ng-table>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'fiesaGrid',
templateUrl: './fiesaGrid.component.html',
})
export class FiesaGridComponent
{
public page: number = 1;
public itemsPerPage: number = 10;
public rows: Array<any> = [];
public columns: Array<any> = [
{ title: 'Name', name: 'name', filtering: { filterString: '', placeholder: 'Filter by name' } },
{
title: 'Position',
name: 'position',
sort: false,
filtering: { filterString: '', placeholder: 'Filter by position' }
},
{ title: 'Office', className: ['office-header', 'text-success'], name: 'office', sort: 'asc' },
{ title: 'Extn.', name: 'ext', sort: '', filtering: { filterString: '', placeholder: 'Filter by extn.' } },
{ title: 'Start date', className: 'text-warning', name: 'startDate' },
{ title: 'Salary ($)', name: 'salary' }
];
public config: any = {
paging: true,
sorting: { columns: this.columns },
filtering: { filterString: '' },
className: ['table-striped', 'table-bordered']
};
private data: Array<any> = [
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position1', office: 'office1' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position2', office: 'office2' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position3', office: 'office3' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' },
{ name: 'Name', salary: 'Salary', startDate: 'SomeDate', ext: 'ext', position: 'position', office: 'office' }
];
public constructor() {
this.length = this.data.length;
}
public ngOnInit(): void {
this.onChangeTable(this.config);
}
public onChangeTable(config: any, page: any = { page: this.page, itemsPerPage: this.itemsPerPage }): any {
this.rows = this.data;
}
}
Exception: Call to Node module failed with error: Error: Uncaught (in promise): TypeError: Cannot read property 'toLowerCase' of undefined
TypeError: Cannot read property 'toLowerCase' of undefined
at DefaultServerRenderer2.setProperty (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\main-server.js:11685:54)
at RendererAdapter.module.exports.RendererAdapter.setElementProperty (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:21232:23)
at setProperty (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\main-server.js:7569:14)
at new NgTableFilteringDirective (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\main-server.js:7581:9)
at createClass (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:21631:26)
at createDirectiveInstance (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:21459:37)
at createViewNodes (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:22822:49)
at Object.createEmbeddedView (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:22715:5)
at TemplateRef_.module.exports.TemplateRef_.createEmbeddedView (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:21040:38)
at ViewContainerRef_.module.exports.ViewContainerRef_.createEmbeddedView (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:20832:52)
at resolvePromise (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83659:31)
at resolvePromise (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83630:17)
at C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83707:17
at ZoneDelegate.module.exports.ZoneDelegate.invokeTask (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83316:31)
at Object.onInvokeTask (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:14877:37)
at ZoneDelegate.module.exports.ZoneDelegate.invokeTask (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83315:36)
at Zone.module.exports.Zone.runTask (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83083:47)
at drainMicroTaskQueue (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83476:35)
at ZoneTask.invoke (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:83382:25)
at data.args.(anonymous function) (C:\BitBucket\Animesh\Research\DotNetCoreSampleApp\DotNetCorAngulate\ClientApp\dist\vendor.js:84294:25)
Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance+<InvokeExportAsync>d__7.MoveNext()
DefaultServerRenderer2.prototype.setProperty = function (el, name, value) {
checkNoSyntheticProp(name, 'property');
_angular_platformBrowser.ɵgetDOM().setProperty(el, name, value);
// Mirror property values for known HTML element properties in the attributes.
var /** @type {?} */ tagName = ((el.tagName)).toLowerCase(); // Exception occured on this line
if (value != null && (typeof value === 'number' || typeof value == 'string') &&
this.schema.hasElement(tagName, EMPTY_ARRAY) &&
this.schema.hasProperty(tagName, name, EMPTY_ARRAY) &&
this._isSafeToReflectProperty(tagName, name)) {
this.setAttribute(el, name, value.toString());
}
};