Reputation: 5396
We already have a web application which is suitable and designed for desktop users, now we decided to use Angular power and develop a new version of our website just for mobile device users.
I mean we want to have another version on our website which is fully optimized for our mobile users and this method is named adaptive design.
We detect user type by getting the User-Agent and serve the different web app based on the device type.
We want to use our services, models, directive and pipes, but only components and view, and some logic changes. How can we have multiple Angular projects which use one source base or application? There are lots of shared code which does not need to be re-written
Upvotes: 0
Views: 874
Reputation: 8947
You can use two projects along with a shared library for all your components, services, models, directives and pipes. The configuration is supported by Angular CLI out of the box.
https://angular.io/guide/file-structure#setting-up-for-a-multi-project-workspace
https://angular.io/guide/creating-libraries#getting-started
Upvotes: 2
Reputation: 2165
Sharing a common code base between projects can be achieved either by having it inside a library project or a shared module since a shared module of an angular application can be used across different angular applications in the workspace however the best practise is actually using a library project.
Angular CLI supports library creation since v6. https://angular.io/guide/creating-libraries#getting-started
Upvotes: 1