gpt4 book ai didi

javascript - angularjs 类不工作

转载 作者:行者123 更新时间:2023-11-30 08:31:11 24 4
gpt4 key购买 nike

我是 angularjs 的新手,我制作了如下所示的简单页面,其中我有一个名为“item”的样式,我试图将它提供给 div 但它不起作用但同时如果我提供内联样式然后它将起作用。

可能是什么问题,请有人帮助我

<html lang="en" >
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Angular Material style sheet -->
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.css">
</head>
<body ng-app="KACApp">
<div id="layoutContainer" ng-controller="layoutController as ctrl" style="height:100%">
<div layout="row" layout-xs="column">
<div flex class="item">Item</div>
<div flex="20">Item 2</div>
</div>
</div>

<!-- Angular Material requires Angular.js Libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js"></script>

<!-- Angular Material Library -->
<script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js"></script>
<style>
.item {
background: "#073857";
}
</style>
<!-- Your application bootstrap -->
<script type="text/javascript">
/**
* You must include the dependency on 'ngMaterial'
*/
angular.module('KACApp', ['ngMaterial'])
.controller('layoutController',layoutController)
.run(function() {
console.log('App is ready');
});

function layoutController($scope){

}
</script>
</body>
</html>

最佳答案

只需从您的样式中删除 "即可:

.item {
background: "#073857";
}

改为->

.item {
background: #073857;
}

关于javascript - angularjs 类不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37788258/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com