Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular css files not loading when controlling two Partials with a single Controller

I'm working on a web-application built upon the MEAN stack. I use bootstrap as css lib, and have some css override in two files of mine "app.css" and "mio.css" the app works just fine until I hit refresh in a controller that handles two partials, than everything gets reloaded except for my 2 css files.

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.min.css" rel="stylesheet">

 <link rel="stylesheet" href="css/app.css">
 <link rel="stylesheet" href="css/mio.css">

If I inspect them they contain the index.html data (head body dcc)

could you suggest what's happening??

like image 916
jay Avatar asked Jul 03 '26 08:07

jay


1 Answers

Try using full file paths to the css files. For example..

<link rel="stylesheet" href="/assets/css/app.css">

The issue might be on the server side. Since angular apps are single page ajax applications, the server has to redirect all requests to the index.html page EXCEPT for assets. Your server might be returning the index.html page instead of your css files.

like image 174
Charlie Martin Avatar answered Jul 05 '26 01:07

Charlie Martin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!