如何将Angular2用作非SPA?

编程入门 行业动态 更新时间:2024-10-22 02:42:14
本文介绍了如何将Angular2用作非SPA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚开始使用Angular2,发现在网上可以找到的所有教程仅说明了如何为单页应用程序(SPA)设置Angular2.

I have just started out with Angular2 and found out that all tutorials that can be found on the web only explains how to setup Angular2 for Single Page Apps (SPA).

但是,对于我网站的主页,我仍然想使用PHP,而只是在诸如Login/Signup/Contact之类的一些地方使用Angular2.

However for the homepage of my site I still want to use PHP and just use Angular2 on a few places like Login/Signup/Contact, etc.

如何在联系人页面上初始化联系人组件,在登录页面上初始化登录组件,等等?

How is that possible to initialize the Contact Component on the contact page, Login Component on the login page, etc?

我不希望它们一次全部加载,只是一个简单的组件即可处理登录,注册等功能.

I don't want all of them to load at once, just a simple component that handles the logging in, signing up, etc functions.

我相信在Bootstrapping部分需要做些什么,但是究竟是什么?

I beleive something need to be done on the Bootstrapping part, but what exactly?

编辑:我也可能要在一页上使用登录+注册"组件.

I also might want to use the Login + Signup componenents on one page.

推荐答案

我认为您可以引导该页面上所需的任何组件

I think you could bootstrap whatever component you need on that page

import {bootstrap} from '@angular/platform-browser-dynamic'; import {ContactComponent} from './contactponent'; bootstrap(ContactComponent);

更多推荐

如何将Angular2用作非SPA?

本文发布于:2023-11-15 10:27:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1593614.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   SPA

发布评论

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

>www.elefans.com

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