Reputation: 11389
All:
I am pretty new to ES6/TYPESCRIPT/Angular2, when I went thru the tutorial of Angular2 official site, the first thing confuses me is:
import {Component} from 'angular2/core';
My question is:
What is that "angular2/core"? is that a module directory? or just a namespace string? When I use a component or module, how/where do I find this part?
Thanks
Upvotes: 2
Views: 2086
Reputation: 22705
You might wanna read this part this from doc first
import {AppComponent} from './app.component';
The import statement tells the system it can get an AppComponent from a module named app.component located in a neighboring file. The module name (AKA module id) is often the same as the filename without its extension.
and this
module-name: The name of the module to import. This is a file name.
It should mean a file called core.js, which is here.
And since the module name is the same with filename, so you can see it is from a module called core.
Where to find this ?
for example, if you want to use http service.
look it up in the document api
https://angular.io/docs/ts/latest/api/
http is under angular2/http section
I think that is a good clue that you should import this from angular2/http
Upvotes: 3