简体   繁体   English

angularjs路由问题(ui-router)

[英]angularjs routing problems (ui-router)

I'm new to angularjs (3 days) and the project is simple, (i removed the login logic). 我是angularjs的新手(三天),该项目很简单,(我删除了登录逻辑)。

login page that sends you to the dashboard. 登录页面,将您发送到仪表板。

the dashboard contains 2 views: sidebar and main. 仪表板包含2个视图:侧边栏和主视图。

I'm using ui-router and i have problem with views and states. 我正在使用ui-router,并且在视图和状态方面存在问题。

plunker link : 链接器

for some reason , even the login page dosen't work anymore. 由于某些原因,即使登录页面也无法正常工作。 it used to work and sends me to the dashboard with an empty view ( my views are not empty) 它曾经可以正常工作,并且以空视图将我发送到仪表板(我的视图不是空的)

I found two issues here. 我在这里发现了两个问题。

First of, you need to add reference to your scripts in the index.html page 首先,您需要在index.html页面中添加对脚本的引用

<script src="app.js"></script>
<script src="login/login.js"></script>
<script src="main/dashboard/dash.js"></script>
<script src="main/dashboard/left/assets.js"></script>
<script src="main/main.js"></script>
<script src="services/loginsrv.js"></script>

Secondly, the preview version of the new plunker didn't work with this fix..but the old did.. 其次,新的插件的预览版不适用于此修复程序,但是旧的插件可以。

Here's a working sample 这是一个工作样本

https://plnkr.co/edit/HQkPhKgN6CkAVE99JSk0?p=preview https://plnkr.co/edit/HQkPhKgN6CkAVE99JSk0?p=preview

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

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