angualr ng-zorro 使用指令报错
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { NzModalService } from 'ng-zorro-antd';
import { NgForm } from '@angular/forms';
@Component({
selector: 'list',
templateUrl: './list.html',
styleUrls: ['./list.less'],
})
export class ListComponent implements OnInit {
public ngOnInit () { }
@ViewChild('canvas') private canvas: ElementRef;
@ViewChild('form') private form: NgForm;
public Info: InfoModel = new InfoModel();
public search () {
for (const i in this.form.controls) {
this.form.controls[i].markAsDirty();
}
if (this.form.valid) {
}
}
public accountList = [
{
accountInfo: {
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1526377215350&di=e0de464e570239930220e045edee7e29&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimgad%2Fpic%2Fitem%2Fb8389b504fc2d5620ea214c8ed1190ef76c66c69.jpg',
name: '安宫和牛黄丸',
type: '普通',
},
limit: '永久',
msgCount: 0,
createTime: 10000,
type: '公众号已到期',
},
{
accountInfo: {
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1526377215350&di=e0de464e570239930220e045edee7e29&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimgad%2Fpic%2Fitem%2Fb8389b504fc2d5620ea214c8ed1190ef76c66c69.jpg',
name: '安宫和牛黄丸',
type: '普通',
},
limit: '永久',
msgCount: 0,
createTime: 20000,
type: '未接入公众号',
},
{
accountInfo: {
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1526377215350&di=e0de464e570239930220e045edee7e29&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimgad%2Fpic%2Fitem%2Fb8389b504fc2d5620ea214c8ed1190ef76c66c69.jpg',
name: '安宫和牛黄丸',
type: '普通',
},
limit: '永久',
msgCount: 0,
createTime: 15000,
type: '未接入公众号',
},
];
public displayData = [...this.accountList];
}
class InfoModel {
public keyword: string;
}
<nz-table #filterTable [nzData]="displayData">
module.ts
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { OfficialAccounts } from './officialAccounts.component';
import { ListComponent } from './list/list';
import { RecycleBinComponent } from './recycleBin/recycleBin';
import { AddAccountComponent } from './addAccount/addAccount';
import { OfficialAccountsRouting } from './officialAccounts.routing';
@NgModule({
imports: [
FormsModule, ReactiveFormsModule,
CommonModule,
OfficialAccountsRouting,
NgZorroAntdModule.forRoot(),
],
declarations: [
OfficialAccounts,
ListComponent,
RecycleBinComponent,
AddAccountComponent,
],
providers: [
],
})
export class OfficialAccountsModule { }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是0.7的写法,你是装的 0.7 版本吗
看报错信息,应该是没有引入module
检查下你对应的module.ts里,
@NgModule
装饰器下的imports
配置吧遇到相同的问题了,想请问一下是如何解决的~