arrow_back Back to Notebook
angular/angularjs
angular/angularjs
February 28, 2019

Using ng-switch in AngularJS

ngSwitch is the equivalent of a switch in java or other modern languages

More Info: ngSwitch

Usage example

<div ng-switch="variable">
    <div ng-switch-when="true">1</div>
    <div ng-switch-when="false">2</div>
    <div ng-switch-when="5000">3</div>
    <div ng-switch-default="5000">default</div>
</div>

Thanks for reading!

John Wiseman

Full-Stack Software Engineer building scalable digital solutions. specializing in modern web technologies and mission-critical systems.

© 2026 Wiseman Systems Pty. Ltd.

Navigation

Start a Conversation

Ready to discuss your next project? Let's build something extraordinary together.

Get in Touch