html:
<p class="list list-inset">
<ion-toggle toggle-class="toggle-calm" ng-model="remeberUser" ng-checked="remeberUser">
记住账号{{remeberUser}}
</ion-toggle>
</p>
js:
Why can’t $scope.remeberUser get the value?
My page can display this value when clicked, but js cannot get it, why is this
给我你的怀抱2017-05-15 17:14:39
You can bind a click event above and try passing remberUser as a parameter
天蓬老师2017-05-15 17:14:39
The reason is very simple. There is a one-way flow of data between the parent and child component $scope. The child $scope can access the data model state under the parent scope, but not the other way around. This is because string and Boolean data are basic types and can be shared by reference through objects, such as parentData.remberUer. Or distribute $scope.$emit through events in the child scope, and then listen to $scope.$on in the parent scope.
You can refer to this article: http://www.jianshu.com/p/0fc2...