tri_inn

tri_inn

  • NA
  • 1.2k
  • 223.7k

What is usage of import and export keyword usage in typescri

Apr 12 2017 8:36 AM

i am not familiar with angular 2 and typescript. i was reading a article on web pack from this link http://www.dotnetfunda.com/articles/show/3481/webpack-in-angular2

the article shown how to create 3 different typescript files for customer, address and phone no and there they show some coding part like

  1. import {Address} from "./Address"  
  2.   
  3. class Customer{  
  4. a: Address = new Address();   
  5. Addresses: Array  
  6.  = new Array  
  7. ();  
  8. }  
  9.   
  10. import {Phone} from "./Phone"  
  11.   
  12. export class Address{  
  13. b: Phone = new Phone();  
  14. Phones: Array = new Array();  
  15. }  
  16.   
  17. export class Phone{  
  18.   


just see first Customer class has no export but next two class has export keyword. why

please tell me when to use export keyword and when to use import keyword with a easy example.


Answers (1)