如何创建一个包含另一个AngularCli的AngularCli应用程序?

编程入门 行业动态 更新时间:2024-10-27 19:16:06
本文介绍了如何创建一个包含另一个AngularCli的AngularCli应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Angular2中使用AngularCli开发了一个应用程序,我希望将它用作另一个项目的布局(如MasterPage)。就像一个大的SPA系统。

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:

  • 框架
    • Page A
    • Page B

    框架在 http:// localhost:90 中运行,XPTO在 http:// localhost:91 。它们都在AngularCli上运行。

    The Framework is running in localhost:90 and XPTO is running in localhost:91. Both of them is running on AngularCli.

    我想创建一个结构,当我点击页面A或页面B时,浏览器不会重新加载,它会给出用户的app样式,将页面加载为SPA ACROSS站点。

    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.

    主要原因是重用Javascripts,CSS和de中的许多其他文件其他20个项目的框架项目。我不希望在这些项目中复制所有组件,文件等。

    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.

    今天我们使用MVC3和RazorGenerator创建.cshtml作为DLL,将Framework中的.cshtml重用到其他模块。

    Today we use MVC3 and the RazorGenerator to create .cshtml as a DLL to reuse the .cshtml from Framework to other modules.

    但我们想要去AngularCli。有没有办法做到这一点?如果不是,有没有办法在AngularCli中创建一个可以重用组件和其他文件的模板?

    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 ?

    谢谢!

    推荐答案

    您可以将共享的Angular组件和模块放入单独的npm包中,并将此包用作其他项目的依赖项。 为了引用你的npm包(我假设它不是在npmjs上托管),你可以指定一个git存储库或本地路径。 以下是package.json的示例

    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 hosted at npmjs) 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" } }

    在这里查看依赖项部分 docs.npmjs/files/package.json

更多推荐

如何创建一个包含另一个AngularCli的AngularCli应用程序?

本文发布于:2023-11-14 03:16:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586065.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建一个   应用程序   AngularCli

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!