Alex
Alex

Reputation: 187

angularjs $ionicPopup.prompt OK button with ng-disable attribute

I'm using $ionicPopup.prompt with OK button, which I try to disable programmatically if none of the input option is selected.

Even if I put: attr: 'ng-disabled="true" ' it has no effect. What I expect is for the OK button to be disabled and the popup to remain on the screen until one of the input options is selected.

eg.

$ionicPopup.prompt({
                    title: '<h3>BLAH</h3>',
                    subTitle: '<h3>Please select one of the following options:</h3>',
                    template: 'BLAH BLAH <br>\n\</span>',
                    scope: $scope,
                    buttons: [
                        {   text: '<b>OK</b>', 
                            type: 'button-positive', 
                            attr: 'ng-disabled="true"',
                            onTap: function(res) {
                                    return true;
                                }
                            }}
                    ]
                }).then(function(res) {
                 ;//BLAH

                }, function(err) {
                    console.log('Err:', err);
                }, function(msg) {
                    console.log('message:', msg);
                });

Upvotes: 4

Views: 1674

Answers (1)

Swagat
Swagat

Reputation: 789

You can directly use buttons:null rather than using attr: 'ng-disabled="true" '. buttons:null will remove ok button from your popup...

Upvotes: 2

Related Questions