title: How to implement a lib in angular2
body: <p>I have a function and it's being used in different components.
  To use it across few components, i am pasting the same code in each component. 
  I want to create a lib, in which i will write this method and then import it across the components. Please suggest a way how to approach.</p>
  
  <pre><code>@Component({
    // Some metadata 
  })
  export class ComA  {
     dataValid(val: any): string {
         // some login
      }
  }   
  
  
  
  @Component({
    // Some metadata 
  })
  export class ComB  {
     dataValid(val: any): string {
         // some login
      }
  }
  </code></pre>
  
  <p>Here i am using dataValid() function repeatedly.</p>
  
  <p>I want some thig like </p>
  
  <pre><code>@Component({
    // Some metadata 
  })
  export class ComA extends GenericLib {
  
  }   
  
  
  
  @Component({
    // Some metadata 
  })
  export class ComB extends GenericLib {
  
  }
  </code></pre>
  
  <p>And use dataValid() function in GenericLib class</p>