gpt4 book ai didi

angular - 无法绑定(bind)到 'placeholder',因为它不是 'ng-multiselect-dropdown' 的已知属性

转载 作者:行者123 更新时间:2023-12-03 18:40:56 24 4
gpt4 key购买 nike

我想实现自动完成功能,所以我发现一个相同的选项是使用多选下拉菜单。所以我使用了这个模块 -

https://www.npmjs.com/package/ng-multiselect-dropdown

但是在同上实现之后,我得到了这些错误 -

错误 -

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'placeholder' since it isn't a known property of 'ng-
multiselect-dropdown'.
1. If 'placeholder' is an Angular directive, then add 'CommonModule'
to the '@NgModule.imports' of this component.
2. To allow any property add 'NO_ERRORS_SCHEMA' to the
'@NgModule.schemas' of this component. ("

<ng-multiselect-dropdown
[ERROR ->][placeholder]="'custom placeholder'"
[data]="dropdownList"
[(ngModel)]="selectedItems"
"): ng:///AdminLayoutModule/HierarchySearchComponent.html@7:0

当我在我的 component.html 中评论占位符时,我收到了这个错误 -
Can't bind to 'data' since it isn't a known property of 'ng- 
multiselect-dropdown'.
1. If 'data' is an Angular directive, then add 'CommonModule' to the
'@NgModule.imports' of this component.
2. To allow any property add 'NO_ERRORS_SCHEMA' to the
'@NgModule.schemas' of this component.
"
<ng-multiselect-dropdown
[placeholder]="'custom placeholder'"
[ERROR ->][data]="dropdownList"
[(ngModel)]="selectedItems"
[settings]="dropdownSettings"
"): ng:///AdminLayoutModule/HierarchySearchComponent.html@8:2

并且类似的错误一直持续到最后一个属性。

更新

app.module.ts
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';


import { AppRoutingModule } from './app.routing';
import { ComponentsModule } from './components/components.module';

import { AppComponent } from './app.component';

import { AdminLayoutComponent } from './layouts/admin-layout/admin-layout.component';

//------------- Imported Modules -------------------------

import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';
import { CommonModule } from '@angular/common';


@NgModule({
imports: [
BrowserAnimationsModule,
FormsModule,
HttpModule,
ComponentsModule,
RouterModule,
AppRoutingModule,
NgbModule.forRoot(),
NgMultiSelectDropDownModule.forRoot(),
CommonModule,


],
declarations: [
AppComponent,
AdminLayoutComponent,


],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

最佳答案

层次结构搜索组件 - 这是您正在使用的组件ng-multiselect-dropdown .

所以可能你会有 HierarchySearch.module.ts .

您只需删除 NgMultiSelectDropDownModule.forRoot() 从 app.module.ts 中的 imports:[] 和 中导入HierarchySearch.module.ts .

它会工作的。!

关于angular - 无法绑定(bind)到 'placeholder',因为它不是 'ng-multiselect-dropdown' 的已知属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52925489/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com