十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要介绍AngularJS中ng-class样式如何切换,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
创新互联公司长期为近千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为萧县企业提供专业的做网站、网站制作,萧县网站改版等技术服务。拥有10年丰富建站经验和众多成功案例,为您定制开发。1、HTML
FirstSecondThird
AllFirstSecondThird
2、controller
appControllers.controller('TestlCtrl', function ($scope, $state) {
$scope.isFirst = false;
$scope.isSecond = false;
$scope.isThird = false;
$scope.hasAll = false;
$scope.hasFirst = false;
$scope.hasSecond = false;
$scope.hasThird = false;
$scope.toggleAll = function () {
$scope.hasAll = !$scope.hasAll;
console.log($scope.hasAll);
var dynamicValue = $scope.hasAll;
$scope.hasFirst = dynamicValue;
$scope.hasSecond = dynamicValue;
$scope.hasThird = dynamicValue;
}
$scope.toggleFirst = function () {
$scope.hasFirst = !$scope.hasFirst;
checkAll();
}
$scope.toggleSecond = function () {
$scope.hasSecond = !$scope.hasSecond;
checkAll();
}
$scope.toggleThird = function () {
$scope.hasThird = !$scope.hasThird;
checkAll();
}
function checkAll() {
if ($scope.hasFirst == true && $scope.hasSecond == true && $scope.hasThird == true) {
console.log("123ok");
$scope.hasAll = true;
} else {
console.log("123no");
$scope.hasAll = false;
}
}
})3、效果图

4、循环列表,判断索引添加样式
*、
合作 {{item.VendorName}}
以上是“AngularJS中ng-class样式如何切换”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联网站建设公司行业资讯频道!
另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。