Reputation: 11389
All:
When I read "Angular2 5mins start"-Tutorial, the first syntax confuses me:
import {bootstrap, Component} from 'angular2/angular2';
I wonder where can I find this syntax from TypeScript (I only find import, but not import...from)?
Thanks
Upvotes: 1
Views: 644
Reputation: 13211
This Syntax was added in ES6 for JavaScript, here is the complete list and explanation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
import { member1 , member2 } from "module-name";
... is the one you found in your Tutorial.
Note that this ES6-JavaScript feature is not supported in any Browser as of today. But TypeScript / AngularJS will deal with it.
There was no such syntax in the original TypeScript.
Here is the TyepScript Handbook about import
: http://www.typescriptlang.org/Handbook#modules-going-external
Upvotes: 1
Reputation: 12114
That syntax is for ES2015, also known as ES6. Basically, it lets you decide what to import from the external files. See some documentation or the standard itself if you need some light reading.
Upvotes: 1