Home
Tutorials
Microsoft Technologies Tutorials
Java Programming Tutorials
Web Designing Tutorials
Script Programming Tutorials
Database Programming Tutorials
Mobile Technologies Tutorials
Other Programming Tutorials
Examples
Articles
Tools
News
AgularJS ng-if Condition Example
Keywords : Angularjs ng-if example, Angularjs ng-if else example, Angularjs ng-if with multiple conditions example, Angularjs ng-if directive example
Example
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> AngularJs ng-if Directive Example </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script> var app = angular.module("AngularngifApp", []); app.controller("ngifctrl", function ($scope) { $scope.items = ['one', 'two', 'three', 'four']; $scope.selectval = "one"; }); </script> </head> <body ng-app="AngularngifApp"> <h2>AngularJS ng-if Directive Example</h2> <div ng-controller="ngifctrl"> Select Item: <select ng-model="selectval" ng-options="item for item in items"> </select> <br /><br /> <div ng-if="selectval=='one'" style="border:1px solid #000; padding:10px; width:20%"> <b>Show Div If Selected Value One</b> </div> </div> </body> </html>
Click Here to See Result
Result
Previous
Next