While loading the page, getting error as cannot find require, in the line where I used templateUrl, but the system is very much stable, don't know where is exactly the error is occuring..
import {Component, OnInit} from '@angular/core';
import {Http} from '@angular/http';
import {Title} from '@angular/platform-browser';
@Component({
selector: 'app-login',
templateUrl: './login.component.html'
})
export class LoginComponent implements OnInit {
}
You're using Typescript, the Typescript Compiler type-checks everything you compile for you to see if it can help pop out some errors for you.
The error you're getting is Typescript letting you know it doesn't recognize the require function.
The application runs fine because it is still eventually available at runtime and thus the error you're getting is merely a "warning" from the Typescript Compiler.
To fix this you'll have to "teach" Typescript about functions such as require,
you can do that by installing nodejs types by running:
npm install --save @types/node
(You'd optionally need to add the following to your tsconfig.json so it loads types from node_modules/@types:
"typeRoots": [
"./node_modules/@types"
],)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With