首先,我的问题是不是关于如何安装角度。我刚刚开始使用这个框架,并且在开始时就已经有了一个问题。
通常我会在apache webserver( private void addSideMenuToLeft(Form f)
{
_("addSideMenuToLeft");
//make a toolbarForLeftMenu so we can use its sidemenu (we can only have one on the left!)
if (toolbarForLeftMenu==null)
{
toolbarForLeftMenu = new Toolbar();
}
toolbarForLeftMenu.setHidden(true);
f.setToolbar(toolbarForLeftMenu);
if (SideMenuLEFT==null) //otherwise it keeps adding each time
{
SideMenuLEFT = (Container)this.createContainer(resources, "SideMenuLEFT");
SideMenuLEFT.setWidth(Display.getInstance().getDisplayWidth()/2);
SideMenuLEFT.setHeight((Display.getInstance().getDisplayHeight()));
SideMenuLEFT.setUIID("SideNavigationPanel");//so we get the nice background.
toolbarForLeftMenu.setUIID("Container");
toolbarForLeftMenu.addComponentToSideMenu(SideMenuLEFT);
//make each button live, there are 2 buttons the icon and the words, for each one
Button btCategory = (Button) Tools.findByNameX("btCategory", SideMenuLEFT,sm );
btCategory.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent evt) {
}
});
_("made left menu");
}
}
)的默认Web文件夹中创建新的Web项目(HTML,PHP ...)。我在/var/www/
下使用angular也做了这个,但似乎应用程序本身只能在webserver根目录的默认端口上访问。就我而言,这是/var/www/firstAngularProject
当我尝试在浏览器localhost:4200
中打开路径时,我看到了索引结构,我认为这可能会成为一个安全问题。
所以我的问题是我应该在哪里安装角度项目或者通常的安装方式是什么?
答案 0 :(得分:2)
当您使用cli命令ng start
(我假设,基于您使用localhost:4200
描述)运行Angular时,您使用webpack-dev-server运行应用程序。这是不合需要的,因为它仅用于开发期间,而不用于生产。
在生产中,Angular就像任何其他前端框架一样。使用ng build --prod
构建应用程序,它会生成许多构建工件(在/dist
文件夹中)。这些工件只是您通过某些网络服务器提供的静态文件,在您的情况下是Apache,将/dist
文件夹的内容复制到/var/www
(或者您的默认网站)文件夹)以及它的相关信息。