简体   繁体   English

角引导日历刷新视图

[英]Angular bootstrap calendar refreshview

I have broadcast new event date from first controller. 我已经从第一个控制器广播了新的事件日期。

Second controller check broadcast and update the calendar. 第二个控制器检查广播并更新日历。

angular.module('app',[])
.controller('firstCtrl',function(){
 $scope.$watch(function () { return $scope.calData;},function(newVal,oldVal){ 
   if(oldVal!==newVal){
     $timeout(function() {
      $rootScope.$broadcast('updateCalData',$scope.zoneData);
    });
   }
  }); 
})
.controller('secCtrl',function(){
  $rootScope.$on('updateCalData',function(event,args){
  eventCalendar(args);  
 })
  function eventCalendar(){
    //........
  }
})

PROBLEM 问题

Currently views doesn't get populated with new event data. 当前,视图未填充新的事件数据。 I have to manual refresh the page to see the changes. 我必须手动刷新页面才能看到更改。

I am using Ionic Framework 我正在使用离子框架

Thanks, any help appreciated 谢谢,任何帮助表示赞赏

Use scope.apply 使用scope.apply

if(!$scope.$$phase) {
          $scope.$apply()
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM