我已经使用ng-show制作锚标签以显示条件。如何处理点击锚点并显示内容
<span><a class = "req-clickable" ng-show = "vm.inScopeServicesListLength >= 6">+{{vm.moreInscopeServices}}more</a>
<span>
答案 0 :(得分:1)
点击更多
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl as vm">
<span><a class= "req-clickable" ng-click="vm.increase()" ><span ng-show = "vm.inScopeServicesListLength >= 1">+{{vm.moreInscopeServices}} </span>more</a><span>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
var vm = this;
vm.inScopeServicesListLength = 0;
vm.moreInscopeServices = 'NEW' ;
vm.increase = function(){
vm.inScopeServicesListLength++;
};
});
</script>
</body>
</html>