Reputation: 805
I am having two angular 2 apps in my website and I want to call a method from app 1 services in app 2 services, Note: the two apps are completely separated each of them has its own files and components
Upvotes: 0
Views: 38
Reputation: 142
You can import the app1 module into app2
import { app1Module} from '../app1/app1.module';
@NgModule({
declarations: [..., ...],
imports: [app1],
bootstrap: [...],
providers: [...]
})
Or you can import the service class directly, so to import app1's service (app1Service) into app 2....
import { app1Service } from '../app1/services/app1.service';
@NgModule({
declarations: [..., ...],
imports: [...],
bootstrap: [...],
providers: [app1Service]
})
Upvotes: 2