簡體   English   中英

獲取構建錯誤“NgSemanticModule中的錯誤不是NgModule”即使添加了依賴項並導入到郵件模塊

[英]Getting Build Error “ ERROR in NgSemanticModule is not an NgModule ” Even after adding dependencies and importing to mail module

我在這里分享了我的模塊,組件和包文件,我嘗試使用帶有ngif click事件但仍然收到錯誤。 它顯示的錯誤是“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.d.ts在NG-語義節點包:

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

...

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

Reference

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM