AngularJS ng-if with multiple conditions. You can use the below example to use ng-if with multiple conditions.
HTML
1 2 3 4 5 | <div ng-controller="fessCntrl"> <label ng-repeat="(key,val) in list"> <input type="radio" name="localityTypeRadio" ng-model="$parent.localityTypeRadio" ng-value="key" />{{key}} <div ng-if="key == 'City' || key == 'County'"> <pre>City or County !!! {{$parent.localityTypeRadio}} |
1 | Town!!! {{$parent.localityTypeRadio}} |
JavaScript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | var fessmodule = angular.module('myModule', []); fessmodule.controller('fessCntrl', function ($scope) { $scope.list = { City: [{name: "cityA"}, {name: "cityB"}], County: [{ name: "countyA"}, {name: "countyB"}], Town: [{ name: "townA"}, {name: "townB"}] }; $scope.localityTypeRadio = 'City'; }); fessmodule.$inject = ['$scope']; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.