我如何添加多个popover到离子1

时间:2017-11-17 09:32:39

标签: angularjs ionic-framework popover

我正在使用Ionic 1制作应用指南(教练标记)。(使用离子1,Angularjs)

我认为结构是这样的。应用指南似乎是讲话泡泡。

enter image description here

我想也许可以使用$ ionicPopover。但如果存在其他方式,请推荐。

我以奇怪的方式有几个弹出窗口,但我不知道如何在每个弹出窗口中放置差异内容。

在示例中,popover中只有相同的内容(例如点击),但我想要输入不同的内容。

所以我试过了。

js文件。

$ionicPopover.fromTemplateUrl('widgets/guide-popover.html', {
    scope: $scope
}).then(function(popover) {
    $scope.popover = popover;
    $scope.popoverList = "hi!";
}); 

$ionicPopover.fromTemplateUrl('widgets/guide-popover.html', {
    scope: $scope
}).then(function(popover) {
    $scope.popover1 = popover;
    $scope.popoverList = "touch here.";
});

~~~

$scope.$on('$ionicView.afterEnter', function () {            
    $scope.popover.show(angular.element(document.querySelector(".poptest")));
    $scope.popover1.show(angular.element(document.querySelector(".poptest1")));
    $timeout(function() {
        $scope.popover.hide(angular.element(document.querySelector(".poptest")));
        $scope.popover1.hide(angular.element(document.querySelector(".poptest1")));
    }, 4000);
});

pug文件(html)

ion-popover-view
ion-content {{popoverList}}

是的,我知道存在很多问题。但在这段代码中,最大的问题是将不同的值放在一个变量中。请帮助....

0 个答案:

没有答案