1

Before I start, I want to emphasize that I am new at both javascript and Angular.js

I am currently using tennisgent's angular-routing-styles and it works sometimes. I did everything correctly but for some reason occasionally there's a delay that causes CSS to not load when switching through the navigation, showing unformatted html for a split second.

AngularCSS by door3 simply doesn't work for me, I tried installing it three times and it just causes everything to fail.

I can't put all of this in a jsfiddle, so I've included a temporary tunnel to my local webserver: http://e5fe67b0.ngrok.io

Switch between music and about a few times and you'll see the lag happening occasionally.

Why is this happening?

9
  • why do you need stylesheets per route? is your CSS too big, even after minifying? Maybe it would be better if you include one concated+minified CSS file for you whole app! Does it work if you use just 1 css file? Commented Jun 24, 2015 at 20:23
  • As you can see by switching, the nav bar highlights what is selected + there are elements on each page that need to be dynamic to the individual page. Commented Jun 24, 2015 at 20:25
  • yes, but you don't need to achieve that with CSS files per routes! Maybe just add a class to body on specific routes. Commented Jun 24, 2015 at 20:29
  • the problem here is that the CSS loads after switching the route, when you already have the CSS loaded there will be no "flash of unstyled content " (FOUC) Commented Jun 24, 2015 at 20:31
  • 1
    "unspoken rules" are the cause of useless arguments, like tables vs. divs. Do what works for you. If inline CSS is satisfactory, use it. Commented Jun 24, 2015 at 20:36

1 Answer 1

1

So using a <style>css here</style> in each page solved it for me.

It seems that those scripts are outdated and no longer works correctly with angular.js so using inline or <style> should work fine.

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

Comments

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.