Javascript 在ng演练指令触发之前设置延迟
我目前正在使用指令(Plunker:)为我的应用程序创建一系列屏幕指令 我想在动画自动加载之前设置一个延迟。有人知道最好的方法吗 controller.jsJavascript 在ng演练指令触发之前设置延迟,javascript,angularjs,ionic-framework,Javascript,Angularjs,Ionic Framework,我目前正在使用指令(Plunker:)为我的应用程序创建一系列屏幕指令 我想在动画自动加载之前设置一个延迟。有人知道最好的方法吗 controller.js $scope.showAccountsWalkthrough = true; $scope.accountsWalkthrough = { steps : [ { id: "new-account-button", text : "Some text here"
$scope.showAccountsWalkthrough = true;
$scope.accountsWalkthrough = {
steps : [
{
id: "new-account-button",
text : "Some text here"
},
{
id: "scan-all-button",
text : "Some text here"
},
{
id: "accounts-list",
text : "Some text here"
}
],
currentIndex : 0
};
$scope.nextAccountsWalkthrough = function() {
ionic.requestAnimationFrame(function() {
if($scope.accountsWalkthrough.currentIndex < $scope.accountsWalkthrough.steps.length-1) {
$scope.accountsWalkthrough.currentIndex++;
$scope.showAccountsWalkthrough = true;
}
});
$scope.showcountswalkthrough=true;
$scope.accountsWalkthrough={
步骤:[
{
id:“新帐户按钮”,
文本:“这里有一些文本”
},
{
id:“扫描所有按钮”,
文本:“这里有一些文本”
},
{
id:“帐户列表”,
文本:“这里有一些文本”
}
],
当前索引:0
};
$scope.nextAccountsWalkthrough=function(){
ionic.requestAnimationFrame(函数(){
if($scope.accountsWalkthrough.currentIndex<$scope.accountsWalkthrough.steps.length-1){
$scope.accountsWalkthrough.currentIndex++;
$scope.showcountswalkthrough=true;
}
});
}
view.html
<walkthrough
id="accounts_view_walkthrough"
walkthrough-type="transparency"
focus-element-id="{{ accountsWalkthrough.steps[accountsWalkthrough.currentIndex].id }}"
main-caption="{{ accountsWalkthrough.steps[accountsWalkthrough.currentIndex].text }}"
force-caption-location="BOTTOM"
is-active="showAccountsWalkthrough"
is-bind-click-event-to-body="true"
on-walkthrough-hide="nextAccountsWalkthrough()"
is-round="false">
</walkthrough>
这解决了问题
setTimeout(function(){
$scope.showAccountsWalkthrough = true;
}, 1000);
这解决了问题
setTimeout(function(){
$scope.showAccountsWalkthrough = true;
}, 1000);
在
setTimeout
中执行showcountswalkthrough
怎么样?@swapnesh-我该怎么做?您能给我看一个代码示例吗?这个选项是如何将单击事件绑定到body=“true”
的?我在插件的文档中没有看到它?在setTimeout
中执行showcountswalkthrough
怎么样?@swapnesh-我该怎么做?您能给我看一个代码示例吗?这个选项是如何将单击事件绑定到body=“true”
的?我没有在插件的文档中看到它?