0

Hi I just started working with an IIS server for my AngularJS project.

So my problem is that my project loads angular, but not .css files, neither my own nor bootstraps.

I have looked at the big fat web, and I noticed that most solutions is to check static content in Windows features. However that was already ticked for me. And I'm wondering if there are other solutions?

enter image description here


index.html

<!doctype html>
<html ng-app="SimPlannerApp">
    <head>
        ...

        <!-- Load Bootstrap CSS library -->
        <link type="text/css" href="lib/bootstrap-3.3.5-dist/css/bootstrap.min.css">

        <!-- Load AngularJS modules -->
        <script src="lib/Angular-1.4.7/angular.min.js"></script>
        <script src="lib/Angular-1.4.7/angular-ui-router.min.js"></script>

        <!-- Load AngularJS Application -->
        <script src="core.js"></script>

        <!-- Our CSS -->
        <link type="text/css" href="assets/styles/main.css">
        <link type="text/css" href="assets/styles/nav.css">
    </head>

    <body>
        ...

        <!-- This is where page content is inserted to -->
        <div ui-view></div>
    </body>
</html>


File tree

  • assets
  • styles
    • main.css
    • nav.css
  • lib
  • Angular-1.4.7
    • angular.min.js
    • angular-ui-router.min.js
  • bootstrap-3.3.5-dist
    • css
      • bootstrap.min.css
  • index.html
  • core.js


Files loaded to the browser

enter image description here

10
  • 4
    have you refered them with correct path on the page? Commented Oct 28, 2015 at 20:22
  • 1
    CSS is served by the Static Content handler. What HTTP response (including any message in the HTML) does IIS give you when you request a CSS file? Maybe you have a File Extension MIME-type entry deleted by mistake. Commented Oct 28, 2015 at 20:27
  • 1
    You say "not loading"... are you seeing any 404 Not Found? Commented Oct 28, 2015 at 20:28
  • 1
    In your server, don't you have any code (it looks like MVC here). I mean is that a visual studio website project or pure static files? Commented Oct 28, 2015 at 20:37
  • 1
    In the IIS Manager, is there an entry for the .css extension to treat them as text/css? Commented Oct 28, 2015 at 20:39

1 Answer 1

2

A guy in my team found the solution. When referencing the stylesheets I've forgotten the rel="stylesheet" after each of them.

so this

<link type="text/css" href="assets/styles/main.css">

should be this

<link type="text/css" href="assets/styles/main.css" rel="stylesheet">
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.