Title: Error "Please add a @NgModule annotation" in Angular4 · Issue #15763 · angular/angular · GitHub
Open Graph Title: Error "Please add a @NgModule annotation" in Angular4 · Issue #15763 · angular/angular
X Title: Error "Please add a @NgModule annotation" in Angular4 · Issue #15763 · angular/angular
Description: I'm submitting a ... (check one with "x") [X] bug report Current behavior I have an Angular application which imports a module from another repository. So my app.module.ts @NgModule({ imports: [ ... MyCommonModule, ], declarations: [...]...
Open Graph Description: I'm submitting a ... (check one with "x") [X] bug report Current behavior I have an Angular application which imports a module from another repository. So my app.module.ts @NgModule({ imports: [ .....
X Description: I'm submitting a ... (check one with "x") [X] bug report Current behavior I have an Angular application which imports a module from another repository. So my app.module.ts @NgModule({...
Opengraph URL: https://github.com/angular/angular/issues/15763
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error \"Please add a @NgModule annotation\" in Angular4","articleBody":"**I'm submitting a ...** (check one with \"x\")\r\n```\r\n[X] bug report\r\n```\r\n\r\n**Current behavior**\r\nI have an Angular application which imports a module from another repository.\r\n\r\nSo my app.module.ts\r\n```\r\n@NgModule({\r\n imports: [\r\n ...\r\n MyCommonModule,\r\n ],\r\n declarations: [...],\r\n providers: [...],\r\n bootstrap: [AppComponent]\r\n})\r\nexport class AppModule { }\r\n```\r\nand then in my node_modules I have my common repository (installed with yarn/npm in package.json) with the file file my-common-module.d.ts\r\n```\r\n@NgModule({\r\n imports: [...],\r\n declarations: [...],\r\n providers: [...],\r\n exports: [...]\r\n})\r\nexport class MyCommonModule {}\r\n```\r\n\r\nThis works fine with Angular 2.\r\nNow, I delete node_modules and change the version of Angular to 4.0 in the package.json of my app and then yarn again.\r\nI build the app with webpack, no errors, and when I run it I get the following error in the browser\r\n```\r\nUncaught Error: Unexpected value 'MyCommonModule' imported by the module 'AppModule'. Please add a @NgModule annotation.\r\n```\r\n\r\n**Expected behavior**\r\nI'd expect this to work the same with Angular4 or Angular2.\r\n\r\nMy question is, do I need to also upgrade the common module to Angular4 for this to work? I thought that this would already be transpiled to js when I import it in my main app module, maybe I'm wrong.\r\n\r\n**Please tell us about your environment:**\r\nI tested this with webpack-dev-server\r\n\r\n* **Angular version:** 2.0.X\r\nWith 2.0.0 it's working, with 4.0.0 it's not.\r\n\r\n* **Browser:**\r\nI tested this in Chrome and FF.\r\n \r\n* **Language:**\r\nI'm using typescript 2.2.2\r\n\r\n* **Node (for AoT issues):** `node --version` = \r\n","author":{"url":"https://github.com/davidanaya","@type":"Person","name":"davidanaya"},"datePublished":"2017-04-04T17:00:12Z","url":"https://github.com/angular/angular/issues/15763"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:234bf7a1-7503-0f2e-5afc-788b979c1b76 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0FA:172B92:3912CD9:4C036E4:6B021D2A |
| html-safe-nonce | 823ef1351ee5b4a93b46ee14def967d54e26197d4b68725f02442c0a1c816ad9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEZBOjE3MkI5MjozOTEyQ0Q5OjRDMDM2RTQ6NkIwMjFEMkEiLCJ2aXNpdG9yX2lkIjoiMjk0MzMzODk3NjYyMDE5MTAxOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 445fc2ae0231d89dad75f3f5c1ca03181b9ee9647644fbf01f9f837266b7ef99 |
| hovercard-subject-tag | issue:219317586 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/15763/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4792edf7658310a18cc413a75ade58b7afcf3b8fc8d60fc2a33cf3848a8bcd40/angular/angular/issues/15763 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4792edf7658310a18cc413a75ade58b7afcf3b8fc8d60fc2a33cf3848a8bcd40/angular/angular/issues/15763 |
| og:image:alt | I'm submitting a ... (check one with "x") [X] bug report Current behavior I have an Angular application which imports a module from another repository. So my app.module.ts @NgModule({ imports: [ ..... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidanaya |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width