简体   繁体   中英

angularjs routing problems (ui-router)

I'm new to angularjs (3 days) and the project is simple, (i removed the login logic).

login page that sends you to the dashboard.

the dashboard contains 2 views: sidebar and main.

I'm using ui-router and i have problem with views and states.

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

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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