I created a sharepointaddin app, and added 3 new ts item(app.component, app.module, main), and I implement these typescrit files as regular, but when I run, it throws these exceptions; and here is the content of ts files;
app.component.ts
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
message;
constructor() {
this.message = "Teddsdtddsad";
}
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
and in the other hand all packages imported in ts files underlined and says this:
how can I fix this ? Note: there is all packages installed already;
1) Typescript doesn't actually manage modules / packages. It just has language support for the ES2015 syntax. You have to add a module manager js file, like AMD and select it in the configuration file, or in the project -> properties -> Typescript Build
2) Try adding "./" in the the module path . Example: import { enableProdMode } from './@angular/core';
3) are you using external modules or just namespaces? Namespaces have a different syntax.