简体   繁体   English

如何设置本地主机?

[英]How to set up a localhost?

I've been teaching myself the basics of Angularjs, but turns out in order to get the 'routing' working I need to set up a localhost. 我一直在自学Angularjs的基础知识,但事实证明,为了使“路由”工作正常进行,我需要设置本地主机。 I've installed XAMPP and ran both Apache and MySql. 我已经安装了XAMPP并同时运行了Apache和MySql。

However, whenever I run an Angular page on the localhost it throws an error - coming from the angularjs.js itself. 但是,每当我在本地主机上运行Angular页面时,都会引发错误-来自angularjs.js本身。 What am I missing? 我想念什么? And how to get the routing working please? 以及如何使路由正常工作? Am I using the wrong localhost? 我使用了错误的本地主机吗?

只需将完整的代码放在apache htdocs文件夹中即可。

I am not sure why you would need to set up XAMPP for AngularJS, because AngualarJS is a frontend library for Javascript therefore in compiles in the browser, so there's no need to set up a local server using Apache/XAMPP. 我不确定为什么您需要为AngularJS设置XAMPP,因为AngualarJS是Javascript的前端库,因此可以在浏览器中进行编译,因此无需使用Apache / XAMPP设置本地服务器。 Instead, run your site using a text editor like Brackets . 而是使用Brackets之类的文本编辑器运行您的网站。 Remember, the only instance where you need to use XAMPP is if you are running a serverside language like PHP, Perl, Python, ext. 请记住,唯一需要使用XAMPP的实例是,如果您正在运行服务器端语言,例如PHP,Perl,Python,ext。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM