토글이 켜졌다 꺼져있을 때마다 알림을 표시하고 싶지만 찾기가 어렵습니다. 나는이 튜토리얼을 따라하지만 내가 작동하지 않습니다로해야토글을 전환 할 때 경고
http://codepen.io/rossmartin/pen/iwuvC
JS
.controller('shops',['$scope','$http','$timeout',function($scope,$http,$timeout){
$http.get('http://localhost/site/templates/shop.php').success(function(data){
$scope.shops=data ;
$scope.pushNotificationChange = function() {
$timeout(function() {
alert('Push Notification Change: '+ $scope.pushNotification.checked);
}, 0);
};
$scope.pushNotification = { checked: true };
});
}])
HTML
<ion-view align-title="center">
<ion-content overflow-scroll="false" has-bouncing="true" class=padding>
<ion-list>
<div ng-controller="shops" ng-repeat="item in shops">
<ion-item class="item-thumbnail-left item-text-wrap">
<img src="img/index/fashion.png" alt="photo" width="32" height="32" />
<h2>{{item.shop_name}} </h2>
<p>{{item.biz_location}}</p>
<div align="right">
<label class="toggle toggle-balanced">
<input type="checkbox"ng-model="pushNotification.checked"
ng-change="pushNotificationChange()">
<div class="track"><div class="handle"></div></div>
</label>
</div>
</ion-item>
</div>
</ion-list>
</ion-content overflow-scroll="false" has-bouncing="true">
</ion-view>
이 일을하는 방법에 어떤 도움?
, 그것은 외부 $해야 http 콜백 –
@ PankajParkar, 팁 주셔서 감사합니다. 두 개 이상의 토글 스위치가 있고 기본적으로 하나는 자동으로 켜지고 다른 하나가 켜지면 첫 번째 스위치를 끄는 방법 – neiza