angular.js - $scope获取不到值
PHP中文网
PHP中文网 2017-05-15 17:12:39
0
2
641

html:

<p class="list list-inset">
                    <ion-toggle toggle-class="toggle-calm" ng-model="remeberUser" ng-checked="remeberUser">
                        记住账号{{remeberUser}}
                    </ion-toggle>
                </p>
                

js:
$scope.remeberUser 获取不到值是怎么一回事呢


我的页面点击就可以显示这个值,而js取不到,这是为什么

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
给我你的怀抱

You can bind a click event above and try passing remberUser as a parameter

Peter_Zhu

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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template