【发布时间】:2016-04-05 15:34:29
【问题描述】:
我最近开始学习 Angularjs,但在使用角度范围实现 materializecss tooltip 时遇到了困难。
HTML
<div class="color-picker">
<div class="item" ng-repeat="color in colors">
<div class="color tooltipped" data-position="bottom" data-tooltip="color.colorName" ng-style="{'background-color': color.hexValue}"></div>
</div>
</div>
这是颜色数据:
app.controller('mainController', ['$scope', function($scope){
$scope.colors =
[
{
colorName: "red",
hexValue: "#f00"
},
{
colorName: "green",
hexValue: "#0f0"
},
{
colorName: "blue",
hexValue: "#00f"
},
{
colorName: "cyan",
hexValue: "#0ff"
},
{
colorName: "magenta",
hexValue: "#f0f"
},
{
colorName: "yellow",
hexValue: "#ff0"
},
{
colorName: "black",
hexValue: "#000"
},
{
colorName: "white",
hexValue: "#fff"
}
]
}]);
我已成功显示不同的颜色,但未能使用tooltip 显示颜色名称,如果可能的话,我不想使用像angular-materialize 这样的额外插件。谢谢大家。
编辑
抱歉,这是我的 js 文件:
<script src="js/jquery-1.11.2.min.js"></script>
<script src="js/materialize.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="js/main-controller.js"></script>
【问题讨论】:
-
您是否链接了
jquery和materialize.js文件? -
@TirthPatel 似乎是这样,我想知道我是否应该将 materialize.js 放在 angular.js 下方
标签: javascript angularjs tooltip materialize web-frontend