$ionicPopup onTap function

Hi, I have the following popup:

    title: "Find your friends...",
    template: '<input type="text" ng-model="searchTerm">',
    scope: $scope,
    buttons: [
        text: "Search",
        onTap: function(e) {
          //Do other stuff here...

My problem is that the $scope.searchTerm is showing as undefined in the above example. Have I made an error in my code? Or have I misunderstood something more fundamental?


make it like this



template: '<input type="text" ng-model="searchTerm.text">',

this is scoping problem of models in angular. always have the model as property of an object.

Ah, that works now thanks.

Obviously $scope.searchTerm = { text: “”} is initiated earlier in the code.