Search code examples
javascriptangularjsangular-ui-router

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)


Solution

  • 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