Tuesday, September 26, 2017

What does the default keyword in Angular 2 do?

As suggested here, something like this:

export default class InnerGridComponent {

 
 

May be looped in like:

import InnerGridComponent from './innergrid.component';

 
 

Whereas something like so:

export class InnerGridComponent {

 
 

Would be looped in like:

import {InnerGridComponent} from './innergrid.component';

 
 

In the second approach one could have numerous classes in the same file and then loop them in with one import statement, separating the class names with commas inside of the curly braces.

No comments:

Post a Comment