2

I have just "written" (copied structure not content) this little Angular 4 module:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { HttpModule } from "@angular/http";

import { FooterComponent } from "./footer.component";

@NgModule({
  declarations: [
    FooterComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule
  ],
  providers: [],
  bootstrap: [FooterComponent]
})
export class FooterModule { }

When I try an angular build, I get the following error:

ERROR in C:/Projects/Angular 4/Angular4/src/footer.module.ts (7,1): 'from' expected.

To me, line 7, import { FooterComponent } from "./footer.component";, looks syntactically correct, and even has a from. If the from component is bad, I'd rather expect a runtime error.

3
  • Did you try deleting and rewriting (not copy past) this line and the lines before? Commented Jul 9, 2017 at 5:39
  • try to clean cache and restart Commented Jul 9, 2017 at 6:03
  • @Guy, yes, I did. Commented Jul 9, 2017 at 6:18

2 Answers 2

1

Type the following:

import { } from "./footer.component";

Then place the cursor inside the curlies and hit Ctrl-Space in your IDE. See if it suggests FooterComponent. If not, the issue is in the footer.component.ts.

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

Comments

1

It turns out I didn't include a *.Module.ts for my Components. That was tripping up the import's and all sorts of things. I got a clue with a red line under my component decorators; hovering over the line told me my module could not be used here and there.

Adding Module files solved the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.