0

I am trying to print the input value in ionic popup. But it returns 'undefined' in the console instead of the entered text in the input field. I was trying without $scope as well but didn't work. What might be the problem with it? Below you can see the code I use.

function funcNew() {
        var myPopup = $ionicPopup.show({
            template: '<input type="text" ng-model="description">',
            title: 'Enter Description',
            subTitle: '',
            scope: $scope,
            buttons: [
                {
                    text: 'Cancel'
                },
                {
                    text: '<b>Yes</b>',
                    type: 'button-positive',
                    onTap: function (e) {
                        console.log($scope.description);

                    }
            }]
        });
    }
3
  • Does it say what is undefined in the console? Commented Jan 12, 2016 at 12:27
  • No, it just prints 'undefined' instead of the real value of 'description'. Commented Jan 12, 2016 at 12:28
  • A way to troubleshoot this would be do do a console.log($scope) that could give you more insight into what is happening Commented Jan 12, 2016 at 12:34

1 Answer 1

2

Instead of description use data.description in ng-model and in console.log($scope.data.description)

Sign up to request clarification or add additional context in comments.

1 Comment

Glad to know that. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.