更改按钮无法有效工作

时间:2017-03-01 14:57:46

标签: angularjs ionic-framework

我有一个隐藏按钮的应用程序,当按下按钮时,在Ionic中显示另一个按钮处于相同位置(交换)。这样做很好,直到我使用它的插件,然后我必须按两次按钮才能让按钮交换位置。 我想知道这与某些内部过程有关,我还没有足够的知识,并希望得到一些关于如何修复和解释的帮助。

HTML:

<ion-nav-buttons side="right">
   <button class="button" ng-click="readArticle()" ng-if="$root.showStartButton" id="startS">Speech</button>
   <button class="button button-assertive" ng-click="stopReadArticle()" ng-if="$root.showStopButton" id="stopS">Stop</button>
</ion-nav-buttons>

控制器:

// TTS is the plugin and now I'm trying to hide ($root.showStopButton) and show ($root.showStartButton)
document.addEventListener('deviceready', function () {
            TTS.speak(" ", function () {
                $scope.$root.showStopButton = false;
                $scope.$root.showStartButton = true;
                stepp();
            }, function (reason) {
                console.log(reason);
            });
            }, false);

但是我必须按两次按钮才能调用此功能两次,请问是什么解决方案?

0 个答案:

没有答案
相关问题