3

payment-details.component.ts:

   import { Component, OnInit } from '@angular/core';

@Component({
      selector: 'app-payment-details',
      templateUrl: './payment-details.component.html',
      styleUrls: ['./payment-details.component.css']
    })
    export class PaymentDetailsComponent implements OnInit {
          constructor() { }    
      ngOnInit() {     }
    }



     import { PaymentDetailsComponent } from './Payment/payment-details/payment-details.component';
        import { NgModule } from '@angular/core';
        import { RouterModule, Routes } from '@angular/router';

app-routing.module.ts:

const routes: Routes =  [

  {path : 'payment-details', component:  PaymentDetailsComponent  }
];
@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]

})


export class AppRoutingModule {}

in src folder tsConfig.app.Json:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Error Message:

C:\src\SchoolsMadeEasy\src\app\Payment\payment-details\payment-details.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

I am loosely following heroes tutorial for using routing. Any ideas why my code is not compiling?

3
  • 1
    can you show whats in your tsconfig Commented Feb 12, 2018 at 21:51
  • @PrashantKumar I have edited my question Commented Feb 12, 2018 at 22:34
  • 1
    Try using below code: { "compilerOptions": { "outDir": "../out-tsc/app", "baseUrl": "./", "module": "es2015", "types": [] }, "include": [ "src/**/*" ], "exclude": [ "node_modules", "*/.spec.ts" ] } Commented Feb 13, 2018 at 15:19

3 Answers 3

3

I know it is an old question, but ran into this because I got a similar error message.

In my case it was caused by a case mismatch in the filename and the reference to the file in an import statement.

Sign up to request clarification or add additional context in comments.

Comments

2

I know this is old post but this might help someone to resolve.

adding "preserveSymlinks": true to angular.json did trick for me.

"options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "progress": true,
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico",
              "src/web.config"
            ],
            "styles": [
              {
                "input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
              },
              {
                "input": "node_modules/@progress/kendo-theme-default/dist/all.css"
              },
              "./node_modules/ag-grid-community/dist/styles/ag-grid.css",
              "./node_modules/ag-grid-community/dist/styles/ag-theme-material.css",
              "./node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/styles.scss"
            ],
            "scripts": [],
            "preserveSymlinks": true
          }

2 Comments

searched for hours about this. Thank you very much!
This fixed it for me even when there were no symlinks in the path to the file it said wasn't being compiled.
0

Where is your typescript file located? If it is located outside of the /src/ folder I believe tsconfig cannot find it.

Edit: Try including the following in your tsconfig file:

"src/**/*"

http://www.typescriptlang.org/docs/handbook/tsconfig-json.html

3 Comments

I have tsConfig file in my src folder
Try doing what it suggests? So include something like: { "include": [ "./src" ], "exclude" : ... }
I now get an error : No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '["test.ts","*/.spec.ts"]'.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.