0

I'm trying to include a css file using this code :

HTML code:

<html ng-app="a">
    <head>
         <cssA></cssA>
    </head>
    <body><script src="app.js"></script></body>
</html>

AngularJS

(function () {
    'use strict';

    var app = angular.module('a', []),

    app
        .directive("cssA", function () {
            return {
                restrict: 'E',
                templateUrl: "multiple-css.html"
            };
        });
}());

multiple-css.html

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https:/maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">

How do I please include that html file ?

1 Answers1

1

Directive names are normalized.

In HTML they should be spinal-case:

<html ng-app="a">
    <head>
         <css-a></css-a>
    </head>
    <body><script src="app.js"></script></body>
</html>

In JS, they are camel-case:

app.directive("cssA", function () {
        return {
            restrict: 'E',
            templateUrl: "multiple-css.html"
        };
 });
Michael Kang
  • 52,003
  • 16
  • 103
  • 135
  • Wow ! It's the second upvote I give to you. I'm seeing progress here :) (Although, I have no idea what `spinal-case` means. In Angular docs they refer to it as `snake-case`, I believe...) – gkalpak Jul 02 '14 at 10:16
  • Thanks ExpertSystem:) I'm trying to be more careful with my wording and assumptions. I appreciate the feedback. – Michael Kang Jul 02 '14 at 10:22
  • Its interesting that Wikipedia thinks snake case is variables with underscores, but variables with dashes are 'spinal case' or 'kebab case'. http://en.wikipedia.org/wiki/Snake_case. This seems to be supported by the SO post: http://stackoverflow.com/questions/11273282/whats-the-name-for-snake-case-with-dashes. I wonder if the Angular docs are not using the correct terminology, or maybe it doesn't really matter. – Michael Kang Jul 02 '14 at 14:44