0

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)

2
  • Add 'ui.router' dependency in app module initialization. "loginsrv.js: var app = angular.module('app.services', ['ui.router']);" Commented Feb 23, 2019 at 17:47
  • ui-router is already in the app module. added to the server but nothing changed @lzagkaretos Commented Feb 23, 2019 at 17:52

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

one more thing. what if my app is big with +100 js files. is there an alternative of referencing all js file in index.html ? i've seen some projects without any ref. isn't that the role of my app.js too ? I did ref everything in there.
@AmineDa. You should use a bundler for your app which will compress all the files into one. Take a look at webpack or gulp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.