AngularJs-UI视图内未使用链接rel样式表

时间:2019-09-27 03:40:52

标签: angularjs

  

LINK REL样式表CSS 不能在UI VIEW中反映login.html的CSS

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!-- IMPORT -->       
    <link rel="stylesheet" href="content/css/index.css">
</head>
<body ng-app="test" ui-view>

</body>
<script src="lib\angular\angular.js"></script>
<script src="lib\angular\angular-route.min.js"></script>
<script src="lib\angular\angular-ui-router.min.js"></script>
<script src="app\app.js"></script>    
<script src="app\router\router.js"></script>
</html>

CSS

.turnBlack {
    background: black;
}

ROUTER JS

app.config(['$stateProvider', function ($stateProvider, $urlRouterProvider) {
    $stateProvider
        .state("login", {
            url: "/login",
            templateUrl: "app/view/login.html",
            controller: "loginController"
        })
     $urlRouterProvider.otherwise('/login'); // ALSO THE OTHERWISE IS NOT WORKING
}])

LOGIN.HTML

  

div必须是背景黑色

<div class="turnBlack">
   I WANT TO BE BLACK
</div>

1 个答案:

答案 0 :(得分:-1)

您应该使用ng-class="turnBlack"而不是class="turnBlack"