我正在购买应用程序,我需要检查购物车是否为空,如果不是空的我需要被重定向到另一个页面。我可以用ng-click吗?还是有另一种方式?
$scope.checkCart = function(){
if($scope.items.length != 0){
//how can I do this?
}
else{
$ionicPopup.alert({
title: "Você não fez nenhum pedido ainda!",
okText: "Confirmar",
okType: "button-dark"
});
答案 0 :(得分:0)
.controller('your controller', function($scope, $state,...){
$scope.checkCart = function(){
if($scope.items.length != 0){
$state.go(//the page what you want);
}
else{
$ionicPopup.alert({
title: "Você não fez nenhum pedido ainda!",
okText: "Confirmar",
okType: "button-dark"
});
}
})