search

Home  >  Q&A  >  body text

angular.js - $scope.$watch cannot monitor the input value in the ionic project

Input changes under the ion-content tag $scope.$watch cannot be heard

<ion-view>
    <ion-content>
        <input type="text" ng-model='myNumber' />
        {{myNumber}}
    </ion-content>
</ion-view>

This is how it works

<ion-view>
    <input type="text" ng-model='myNumber' />
    {{myNumber}}
</ion-view>

Excuse me, what is the reason for this?

给我你的怀抱给我你的怀抱2758 days ago1237

reply all(2)I'll reply

  • 阿神

    阿神2017-05-15 16:54:19

    Modify it ion-content

    <ion-content ng-controller="PlaylistsCtrl">
    

    reply
    0
  • 阿神

    阿神2017-05-15 16:54:19

    script
    $scope.payload = {
    myNumber: ''
    }

    <ion-view>

    <ion-content>
        <input type="text" ng-model='payload.myNumber' />
        {{payload.myNumber}}
    </ion-content>

    </ion-view>

    reply
    0
  • Cancelreply