Developer Snippet Diary

how to import ts file in component

1.make any ts file ie data.ts

export class data {
    hello() {
      return "hello";
     }
}

2. import in  component 

import { data} from './data';  
import { Component, OnInit } from '@angular/core';

export class MyTest implements OnInit {
 ngOnInit(): void { 
    console.log("all urls",new data().hello());
  }
}
Posted by: R GONDAL
Email: rizikmw@gmail.com