Are these statements from a specific language/framework, or something custom to Angular 2. I'm trying to understand how Angular 2 works.
import {} from ''
export class ... { }
No, the import and export keywords are not Angular2 specific.
The import statement is used to import functions, objects or primitives that have been exported from an external module, another script, etc. Basically we use the import module to load the Angular2 bundles. For example:
'import {Component, and many more here....} from angular2/core`
Here, Component is a module which is being imported from the bundles of Angular2. angular2/core is not a path - rather, it is predefined bundle of Angular2. If you look at the source code of angular bundle, you can see there's System.register("angular2/core", .... - for this, we have already imported system.js before our Angular in the index.html file. system.js is the module loader here.
The import feature is not implemented in any browsers natively at this time. It is implemented in many transpilers, such as the Traceur Compiler, Babel or Rollup. For more information about the import module, you can read this tutorial about the import module. For the list of imports for Angular2 you can read about this here.
As it is clear from the name, the export statement is used to export functions, objects or primitives from a given file (or module). export is just an identifier so that it can be imported via import in another script. export is also an ES6 module like the import module. An article about export is here. As suggested by Eric in the comments, we have used the export class in the Angular2 project to export classes of the component. For an example, you can refer to my repo here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With