【问题标题】:ng2-table error: Can't bind to ' various items' since it isn't a known property of 'ng-table'ng2-table 错误:无法绑定到“各种项目”,因为它不是“ng-table”的已知属性
【发布时间】:2017-08-17 20:44:37
【问题描述】:

我正在使用 valor 软件 ng2-table,但是当我尝试运行它时,我在控制台中收到以下错误,但编译器很高兴,

关于如何解决这些错误的任何建议,我假设我缺少导入或包或其他东西,但我终生无法解决如何调试此问题。

来自控制台的错误:

Unhandled Promise rejection: Template parse errors:
Can't bind to 'active' since it isn't a known property of 'ng-table'.
1. If 'ng-table' is an Angular component and it has 'active' input, then verify that it is part of this module.
2. If 'ng-table' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 ("="onNewUserChangeTable(newuserConfig)"(cellClicked)="onCellClick($event)" [ERROR ->][active]="selectedNewUserRow"

                        [rows]="newuserRows" [columns]="newuserColumns"): NEWAdminUserTableComponent@38:60
Can't bind to 'links' since it isn't a known property of 'ng-table'.
1. If 'ng-table' is an Angular component and it has 'links' input, then verify that it is part of this module.
2. If 'ng-table' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 ("tive]="selectedNewUserRow"
[rows]="newuserRows" [columns]="newuserColumns" [ERROR ->][links]="newuserLinks" 

                        (editClicked)="onEditClicked($event)"

             "): NEWAdminUserTableComponent@39:72
Can't bind to 'options' since it isn't a known property of 'ng-select'.
1. If 'ng-select' is an Angular component and it has 'options' input, then verify that it is part of this module.
2. If 'ng-select' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 (">

                             <div class="col-sm-8"> 

                                <ng-select [ERROR ->][options]="customersToSelect" formControlName="CustomerID" placeholder="Select Customer Name" [disabl"): NEWAdminUserTableComponent@261:43
Can't bind to 'allowClear' since it isn't a known property of 'ng-select'.
1. If 'ng-select' is an Angular component and it has 'allowClear' input, then verify that it is part of this module.
2. If 'ng-select' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 ("Select" formControlName="CustomerID" placeholder="Select Customer Name" [disabled]="isReadOnlyForm" [ERROR ->][allowClear]="true" 

                                     (deselected)="onCustomerDeselected($event)"): NEWAdminUserTableComponent@261:165
'ng-select' is not a known element:
1. If 'ng-select' is an Angular component, then verify that it is part of this module.
2. If 'ng-select' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("Name</label>

                             <div class="col-sm-8"> 

                                [ERROR ->]<ng-select [options]="customersToSelect" formControlName="CustomerID" placeholder="Select Customer Na"): NEWAdminUserTableComponent@261:32 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:
Can't bind to 'active' since it isn't a known property of 'ng-table'.
1. If 'ng-table' is an Angular component and it has 'active' input, then verify that it is part of this module.
2. If 'ng-table' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 ("="onNewUserChangeTable(newuserConfig)"

                        (cellClicked)="onCellClick($event)" [ERROR ->][active]="selectedNewUserRow"

                        [rows]="newuserRows" [columns]="newuserColumns"): NEWAdminUserTableComponent@38:60
Can't bind to 'links' since it isn't a known property of 'ng-table'.
1. If 'ng-table' is an Angular component and it has 'links' input, then verify that it is part of this module.
2. If 'ng-table' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 ("tive]="selectedNewUserRow"

                        [rows]="newuserRows" [columns]="newuserColumns" [ERROR ->][links]="newuserLinks" 

                        (editClicked)="onEditClicked($event)"

             "): NEWAdminUserTableComponent@39:72
Can't bind to 'options' since it isn't a known property of 'ng-select'.
1. If 'ng-select' is an Angular component and it has 'options' input, then verify that it is part of this module.
2. If 'ng-select' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 (">

                             <div class="col-sm-8"> 

                                <ng-select [ERROR ->][options]="customersToSelect" formControlName="CustomerID" placeholder="Select Customer Name" [disabl"): NEWAdminUserTableComponent@261:43
Can't bind to 'allowClear' since it isn't a known property of 'ng-select'.
1. If 'ng-select' is an Angular component and it has 'allowClear' input, then verify that it is part of this module.
2. If 'ng-select' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
 ("Select" formControlName="CustomerID" placeholder="Select Customer Name" [disabled]="isReadOnlyForm" [ERROR ->][allowClear]="true" 

                                     (deselected)="onCustomerDeselected($event)"): NEWAdminUserTableComponent@261:165
'ng-select' is not a known element:
1. If 'ng-select' is an Angular component, then verify that it is part of this module.
2. If 'ng-select' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("Name</label>

                             <div class="col-sm-8"> 

                                [ERROR ->]<ng-select [options]="customersToSelect" formControlName="CustomerID" placeholder="Select Customer Na"): NEWAdminUserTableComponent@261:32, but from what I can see I have all the correct imports and directives for this to work but evidently something is wrong.


Below is the table code:
/* !!! System Imports !!! */
import { Component, OnInit, ViewChild } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { FormsModule } from '@angular/forms';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { ModalDirective } from 'ng2-bootstrap';
import { ChangeDetectorRef } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';

/* *** Project Imports *** */
import {NewUserService, EventService, ExportToExcel } from '../services/index'; //AuditLogService
import { NewUser, AuditLog} from '../models/index';
import { NewUserGrid } from '../grid/index';
import * as FileSaver from 'file-saver';

let json2csv = require('json2csv');
let jsPDF = require('jspdf');
require('jspdf-autotable');

@Component
(
  {
    selector: 'app-newadminusertable',
    templateUrl: './adminusertable.component.html',
    styleUrls: ['./adminusertable.component.css']
  }
)

export class NEWAdminUserTableComponent implements OnInit
{
 @ViewChild('userModal') public userModal: ModalDirective;
 /* TO REMOVE IN DUE COURSE*/
  //  @ViewChild('file') file: any;
  //  @ViewChild('img') img: any;
 /* TO REMOVE IN DUE COURSE END*/

newusers: NewUser[];
newuser: NewUser;
auditLogModel: AuditLog;


 oldValue: any;
 message: string;
 isEditForm: boolean;
 rowIndex: number;

 loggedUser: any = {};

 myForm: FormGroup;
 isReadOnlyForm: boolean;
 show: boolean;

 //newuser grid code ========================================================================
  public newuserRows: Array < any > = [];
  public newuserColumns: Array < any > = [];
  public newuserPage: number = 1;
  public newuserItemsPerPage: number = 10;
  public newuserMaxSize: number = 5;
  public newuserNumPages: number = 1;
  public newuserLength: number = 0;

  public newuserLinks: any = {
    isEdit: false,
    isDelete: false,
    isView: false
  };

  public gridData: any = {
    grid: '',
    isSuperAdmin: null
  };

  public newuserConfig: any = {};
  public newuserRowCount: number;
  public selectedNewUserRow: number;
  public newuserOtherColumns : number = 0;
  public gridFilteredData : any = {};
  public textMessage : string = '';

 //newuser grid code ========================================================================

 public params : any = {
  }

 constructor(
  private fb: FormBuilder,
  private newuserService: NewUserService,  
  private toasterService: ToasterService,
  private eventService: EventService,

  private newuserGrid: NewUserGrid,
  private loaderService: LoaderService,
  private ref: ChangeDetectorRef,
  private route: ActivatedRoute,
  private router: Router, 
  private exportToExcel: ExportToExcel
 ) { }

 ngOnInit(): void {
  this.InitializeForm();
  this.GetMethods();

 }

//form code==================================================================================================
private InitializeForm()
{

感谢任何建议。

谢谢 安迪

【问题讨论】:

    标签: angular ngtable


    【解决方案1】:

    我解决了我的问题,我在 package.json 文件中有一个对“ng2-table 的依赖项,因此它覆盖了我的自定义 ng2-table。

    删除这个解决了这个问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-10
      • 1970-01-01
      • 2022-11-27
      • 2021-06-16
      • 2021-03-20
      • 2018-02-12
      • 2021-10-24
      相关资源
      最近更新 更多