2

I have a ng-if condition:

<div class="fixed-outside" ng-if="'app.home'|isState">

i.e whenever the state is app.home show the div.

But I want to wait for some time before my div is shown. How can I do that

2 Answers 2

2

I'd suggest to do it with css and add animation with delay for .fixed-outside class. For instance, if you need to wait for 5 seconds before revealing block, you may do something like this:

.fixed-outside {
  animation: 5s fadeIn;

  visibility: hidden;
}

@keyframes fadeIn {
  99% {
    visibility: hidden;
  }
  100% {
    visibility: visible;
  }
}
Sign up to request clarification or add additional context in comments.

Comments

1

You could try this: In your controller make a function that returns app.home but instead of returning it instantly wrap it inside a $timeout and replace on the view ng-if="'app.home'|isState" for the new function.

Something like:

controller

$scope.getAppHome = function(){
    $timeout(function(){
     return home;          //or whatever var 'home' represents on the view 'app.home'
    }, 200);
}

view

<div class="fixed-outside" ng-if="app.getAppHome()|isState">

2 Comments

getAppHome() returns undefined.
Could you show me some minimal reproducible code of what you are trying to do? A snippet or something? I need to see you controller. How is var home being initialized?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.