gpt4 book ai didi

javascript - 获取构建错误 "ERROR in NgSemanticModule is not an NgModule "即使在添加依赖项并导入到邮件模块之后

转载 作者:搜寻专家 更新时间:2023-10-30 21:10:33 25 4
gpt4 key购买 nike

我在这里分享了我的模块、组件和包文件,我尝试将点击事件与 ngif 一起使用,但仍然出现错误。它显示的错误是“NgSemanticModule 中的错误不是 NgModule”我无法理解此错误是由于语义 UI 依赖性还是由于单击事件中缺少某些内容而发生

谁能帮忙提前谢谢。

    // app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component'; //import home components
import { AboutComponent } from './about/about.component'; //import about component
import { NgSemanticModule } from 'ng-semantic';
import { routing } from './app.routing';

@NgModule({
imports: [ BrowserModule, routing , NgSemanticModule,CommonModule ], //other modules the app depends on
declarations: [ AppComponent, AboutComponent, HomeComponent ], // declare all derectives and components
bootstrap : [ AppComponent ] // root component to bootstarp
})
export class AppModule { }


//app.component.ts
import { Component} from '@angular/core';

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

export class AppComponent {
isActive:boolean = true;
isCollapsedMenu() {
this.isActive = !this.isActive;
}

}


//package.json

{
"name": "angularapp",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"ng-semantic": "^1.1.13",
"ng2-bootstrap": "1.1.16-11",
"ngx-bootstrap": "^1.7.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.5",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.77",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}

最佳答案

这样试试,

import { NgSemanticModule } from 'ng-semantic/ng-semantic';

如果你正在使用 angular-cli,试试这个,

将以下内容添加到 ng-semantic 节点包中的 ng-semantic.d.ts 文件中:

import { NgModule } from '@angular/core';

...

@NgModule({
declarations: [
NgSemanticModule
]
})
export declare class NgSemanticModule {
}

Reference

关于javascript - 获取构建错误 "ERROR in NgSemanticModule is not an NgModule "即使在添加依赖项并导入到邮件模块之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44353367/

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