我最近开始学习Angularjs,并且在实现materializecss tooltip时陷入困境。
<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"
}
]
}]);我已经成功地显示了不同的颜色,但没有显示colorName与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>发布于 2016-08-30 07:55:59
发布于 2016-10-17 12:22:05
发布于 2017-02-03 12:33:47
这可以不使用角物化插件。在你的控制器里试试这个:
$('.color-picker').tooltip().tooltip('show');
$(document).ready(function () {
$('.tooltipped').tooltip({ delay: 50 });
});https://stackoverflow.com/questions/36430872
复制相似问题