Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ps-if with all npm packages installed. Try it out:

require("angular/package.json"); // angular is a peer dependency. var psIf = require("ps-if")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ps-if v1.3.0

Angular directive that is a hybrid of ngIf and ngShow


Angular directive that is a hybrid of ngIf and ngShow.

What this does

  • Starts off like ngIf
  • When condition changes it becomes an ngShow
  • If timeout is specified, becomes an ngIf again once condition has been false for long enough.


1. Depend on ps.if

// commonjs users:
angular.module('app', [require('ps-if')]);

// everyone else
angular.module('app', ['ps.if']);

2. Use psIf in places you'd use ngIf or ngShow

<div ps-if="show" ps-cool-down-millis="5000">


Angular expression controlling if children are shown or not.


Optional Angular expression (evaluated once). Once children have been hidden for this many milliseconds, directive acts like ngIf. If omitted, directive will act like ngShow forever.


  1. git clone
  2. cd ps-if/example
  3. bower install
  4. Open index.html in a browser


npm install ps-if --save


bower install ps-if --save



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free