Title: How to create an AngularCli application that contains another AngularCli inside?
Tags: javascript;angular;asp.net-mvc-3;angular-cli
Question: I have an application in development that is in Angular2 using AngularCli, and I want to use it as a "Layout" (like a MasterPage) to another project. Like a big "SPA System".
For example, in the menu we will have the following:
Framework
Page A
Page B
The Framework is running in http://localhost:90 and XPTO is running in http://localhost:91. Both of them is running on AngularCli.
I want to create a structure that when I click on Page A or Page B, the browser doesn't reload and it will give an "app" style to the user, loading the page as a SPA ACROSS the sites.
The main reason is to reuse the Javascripts, CSS and many other files from de "Framework" project to other 20 projects. I don't want to replicate all the components, files and etc across those projects.
Today we use MVC3 and the RazorGenerator to create .cshtml as a DLL to reuse the .cshtml from Framework to other modules.
But we want go AngularCli. Is there any way to do that ? If it isn't, is there some way to create a template in AngularCli that can be reused the components and the other files ?
Thank you !

Here is the accepted answer: You can put shared Angular components and modules into a separate npm package and use this package as a dependency for other projects.
In order to reference your npm package (I assume it's not victoriaperez@example.org) you can specify a git repository or local path.
Here is an example of package.json
"name": "foo",
"version": "0.0.0",
"dependencies": {
"my_git_package": "git+ssh://user@hostname/project.git#commit-ish",
"my_local_package": "file:../foo/bar"
Take a look at dependencies section here https://docs.npmjs.com/files/package.json
Comment for this answer: Hi, added an example to my response
Comment for this answer: Hi Random, thanks for your answer. I'm searching how to do that but when I do npm publish, the package goes to internet ? Do you have some example how to do that ?
Thanks again !


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:04/04/17', 'FavoriteCount': 2.0, 'PostTypeId': 1, 'Tags': '<javascript><angular><asp.net-mvc-3><angular-cli>', 'Title': 'How to create an AngularCli application that contains another AngularCli inside?', 'ViewCount': 99, 'id': 43215304, 'user_AboutMe': '', 'user_AccountId': 1254763.0, 'user_DisplayName': 'galioni', 'user_Reputation': 105.0, 'user_Views': 10.0, 'user_id': 1214465.0}}