Reputation: 388
Having the structure below:
/project1
/app
/components
/services
index.html
/project2
/app
/components
/services
index.html
Is it possible to import a component or service from project2 to project1 and vice versa?
Upvotes: 3
Views: 123
Reputation: 719
To import the component (or) service from another angular2 project you follow the following steps
Upvotes: 0
Reputation: 202138
You could configure SystemJS to use both folders in your index.html
file. This way you will be able to import project elements into another one.
<script>
System.config({
packages: {
'project1/app': {
format: 'register',
defaultExtension: 'js'
},
'project2/app': {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('project1/app/boot')
.then(null, console.error.bind(console));
</script>
Upvotes: 4