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

I use $ ionicPopup.prompt with the OK button, which I try to disable programmatically if none of the input options are selected.

Even if I put: attr: 'ng-disabled = "true" , it does not work. I expect that the OK button will be disabled and the popup will 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);
                });
+4
source share
1 answer

You can directly use buttons:nullinstead of using attr: 'ng-disabled="true" '. buttons:nullwill remove the ok button from your popup ...

+2
source

Source: https://habr.com/ru/post/1650228/


All Articles