title: How to load js and css files on AngularJs when using routes/partials?
body: <p>I'm pretty new to AngularJs, i'm trying to bring on my index a partial, a pretty basic login form with semantic validation.</p>
  
  <p>The issue is that, if i load everything within the index, everything works fine, but if i use Angular routes, my stylesheet and my js script stops working, but only those that have to work with the partials.</p>
  
  <p>Here are the codes.</p>
  
  <p>WORKING CODES:
  index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset = "UTF-8"&gt;
  
          &lt;!--Mandatory links for styles and scripts--&gt;
          &lt;link rel = "stylesheet" type = "text/css" href = "external/semantic/semantic.css"&gt;
  
          &lt;script type = "text/javascript" src = "external/js/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "external/semantic/semantic.js"&gt;&lt;/script&gt;
  
          &lt;script type = "text/javascript" src = "external/angular-1.5.6/angular.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "external/angular-1.5.6/angular-route.js"&gt;&lt;/script&gt;
  
          &lt;!--Own scripts and styles--&gt;
          &lt;link rel = "stylesheet" type = "text/css" href = "app/styles/main.css"&gt;
  
          &lt;script type = "text/javascript" src = "app/modules.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "app/controllers/loginController.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "app/validations/loginFormValidation.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body data-ng-app = "loginApp"&gt;
          &lt;div class = "ui middle aligned center aligned grid" data-ng-app = "loginController"&gt;
              &lt;div class = "column"&gt;
                  &lt;h2 class = "ui icon header"&gt;
                    &lt;i class = "settings icon"&gt;&lt;/i&gt;
                    &lt;div class = "content"&gt;
                      Inicia sesión.
                    &lt;/div&gt;
                  &lt;/h2&gt;
                  &lt;form class = "ui form segment"&gt;
                      &lt;div class = "field"&gt;
                          &lt;div class = "ui left icon input"&gt;
                              &lt;i class = "user icon"&gt;&lt;/i&gt;
                              &lt;input type = "text" name = "username" data-validate = "username" placeholder = "Nombre de usuario" data-ng-model = "username"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class = "field"&gt;
                          &lt;div class = "ui left icon input"&gt;
                              &lt;i class = "lock icon"&gt;&lt;/i&gt;
                              &lt;input type = "password" name = "password" data-validate = "password" placeholder = "Contraseña" data-ng-model = "password"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class = "ui error message"&gt;&lt;/div&gt;
                      &lt;button type = "submit" class = "ui teal fluid submit button" ng-click = "loginUser()"&gt;
                          Login
                      &lt;/button&gt;
                      &lt;div class = "ui divider"&gt;&lt;/div&gt;
                      &lt;a href="#"&gt;Olvidaste la contraseña?&lt;/a&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>modules.js</p>
  
  <pre><code>var login = angular.module('loginApp', ['ngRoute']);
  </code></pre>
  
  <p>loginController.js</p>
  
  <pre><code>login.controller('loginController', function($scope) {
      $scope.loginUser = function (username, password) {
           console.log($scope.username);
          console.log($scope.password);
      }
  });
  </code></pre>
  
  <p>loginFormValidation.js</p>
  
  <pre><code>$(document).ready(function() {
      $('.ui.form')
        .form({
          fields: {
              username: {
                  identifier: 'username',
                  rules: [{
                      type: 'empty',
                      prompt: 'Ingresa tu usuario.'
                  }]
              },
              password: {
                  identifier: 'password',
                  rules: [{
                      type: 'empty',
                      prompt: 'Ingresa la contraseña.'
                  }]
              }
          }
      });
  });
  </code></pre>
  
  <p>Everything up to this point works fine. But I wanted to try out routes adding my stylesheet and the validation script on the partial with no success.</p>
  
  <p>I also tried to leave this files on the index but it didn't work either</p>
  
  <p>BROKEN CODES:
  index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset = "UTF-8"&gt;
  
          &lt;!--Mandatory links for styles and scripts--&gt;
          &lt;link rel = "stylesheet" type = "text/css" href = "external/semantic/semantic.css"&gt;
  
          &lt;script type = "text/javascript" src = "external/js/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "external/semantic/semantic.js"&gt;&lt;/script&gt;
  
          &lt;script type = "text/javascript" src = "external/angular-1.5.6/angular.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "external/angular-1.5.6/angular-route.js"&gt;&lt;/script&gt;
  
          &lt;!--Own scripts and styles--&gt;
          &lt;link rel = "stylesheet" type = "text/css" href = "app/styles/main.css"&gt;
  
          &lt;script type = "text/javascript" src = "app/modules.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "app/controllers/loginController.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "app/validations/loginFormValidation.js"&gt;&lt;/script&gt;
          &lt;script type = "text/javascript" src = "app/configs/mainRoutes.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body data-ng-app = "loginApp"&gt;
          &lt;div data-ng-view&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>mainRoutes.js</p>
  
  <pre><code>login.config(function ($routeProvider) {
      $routeProvider
          .when('/', {
              controller: 'loginController',
              templateUrl: 'app/partials/login/loginFormView.html'
          })
          .otherwise({
              redirectTo: '/'
          });
  });
  </code></pre>
  
  <p>loginFormView.html</p>
  
  <pre><code>&lt;div class = "ui middle aligned center aligned grid"&gt;
      &lt;div class = "column"&gt;
          &lt;h2 class = "ui icon header"&gt;
            &lt;i class = "settings icon"&gt;&lt;/i&gt;
            &lt;div class = "content"&gt;
              Inicia sesión.
            &lt;/div&gt;
          &lt;/h2&gt;
          &lt;form class = "ui form segment"&gt;
              &lt;div class = "field"&gt;
                  &lt;div class = "ui left icon input"&gt;
                      &lt;i class = "user icon"&gt;&lt;/i&gt;
                      &lt;input type = "text" name = "username" data-validate = "username" placeholder = "Nombre de usuario" data-ng-model = "username"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class = "field"&gt;
                  &lt;div class = "ui left icon input"&gt;
                      &lt;i class = "lock icon"&gt;&lt;/i&gt;
                      &lt;input type = "password" name = "password" data-validate = "password" placeholder = "Contraseña" data-ng-model = "password"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class = "ui error message"&gt;&lt;/div&gt;
              &lt;button type = "submit" class = "ui teal fluid submit button" ng-click = "loginUser()"&gt;
                  Login
              &lt;/button&gt;
              &lt;div class = "ui divider"&gt;&lt;/div&gt;
              &lt;a href="#"&gt;Olvidaste la contraseña?&lt;/a&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It seems to load the form and then semantic gives the style based on the class of the divs, but then it ignores the extra styling applied on "main.css" and the validation on "loginFormValidation.js".</p>
  
  <p>All the other files still work except this two, and i think that this will happen with other files if i add some more.</p>
  
  <p>I don't know what to do now, i tried adding this files into the partial, but it didn't work.</p>
  
  <p>Is there anyway to achieve this?</p>
  
  <p>Thank you very much!!</p>