Angular2 the right way to import a html template?


#1

I’m following the Angular2 Meteor tutorial , and the example there doesn’t seem to work very well.

The application works, but i keep getting these errors, and if i got away for the secondary components, same thing doesn’t work for app.ts. If i try adding import { template } from './app.html the app crashes.

What is the correct syntax for adding Angular2 html template?


#2

In your user-details.ts, try changing

@Component({
  ...
  template,
  ...
})

to

@Component({
  ...
  template: template,
  ...
})

#3

The doesn’t help. The red squigly in VS Code is still there and so is the error, but the app still works.


#4

You are using the intended syntax.
The warning messages will disappear with the next typescript release.
See here: https://github.com/Urigo/angular2-meteor/issues/328#issuecomment-231614453