vyshnavi
vyshnavi

Reputation: 177

How to display modal pop up based on ng-if value in angular js

I am new to angular js , i need to display the modal pop up box when the ng- if statement is false . could u guys please help me in this problem ?

in html :

<div ng-if="inputdata == false"  >
  </div>

if the input data is false i need to show the modal popup window .

Upvotes: 1

Views: 4051

Answers (1)

Roh&#236;t J&#237;ndal
Roh&#236;t J&#237;ndal

Reputation: 27242

Try this :

controller :

var myApp = angular.module('myApp', []);

myApp.controller('myCtrl', function($scope) {
  $scope.inputdata = true;
});

View :

<div class="content" ng-app="myApp" ng-controller="myCtrl">
    <div class="field">
        <button ng-click="inputdata = false">Show Popup</button>
        <div ng-show="!inputdata" class="popup">
        </div>
    </div>
</div>

Style :

 .popup{padding:10px;display:block;position:absolute;top:0;left:0;height:30px;width:200px;background:#efefef;}

Upvotes: 1

Related Questions