我试图在用户首次登录时使用$ ionicPopup作为快速教程屏幕。登录后,他们永远不需要再次看到该消息。我还没有找到任何关于如何在Ionic Framework中执行此操作的示例。
这是我到目前为止的代码,我将它放在$ timeout函数()中,以便我可以设置超时。
$超时(函数(){ var myPopup = $ ionicPopup.show({
template: '<h4 class="ion-ios-search-strong"> Choose a store</h4></br><h4 class="ion-coffee"> Select a drink</h4></br><h4 class="ion-wrench"> Customize your coffee</h4></br><h4 class="ion-card"> Pay from your phone</h4></br><h4 class="ion-happy-outline"> Your coffee is ready</h4></br>',
title: 'How to use Joe',
// subTitle: 'Your coffee is a few taps away',
scope: $scope,
buttons: [
{ text: 'Got it!' },
]
});
myPopup.then(function(res) {
console.log('Tapped!', res);
});
},5000);
答案 0 :(得分:1)
你可以:
firstTime
设置为true
。firstTime
之前,请检查true
是否为$ionicPopup.show
。firstTime
设置为false
以查看它是否为true
。firstTime
存储在Angular服务中。如果您希望即使用户刷新,firstTime
的值也会保留,您可以将其存储在localStorage
中。例如,请查看angular-local-storage。