2017-09-13 37 views
1

我想在数据库中添加一行,在此之后,重新加载当前页面以更新新数据,但是当我使用$ state.reload()时,所有页面变黑并且我无法与此页面进行互动。

DeviceService.addDevice($scope.newDevice).then(function (result) { 
     if (result.data.success) { 
      flash.success = result.data.message; 

     // current state is 'profile' and I want to reload to update data 
      $state.go('profile', {}, { reload: true }); 

     } else { 
      flash.error = result.data.message; 
     } 

     }); 

重装后,从这样的:enter image description here

变成这样: enter image description here

更新: 我想,也许是因为我用一个模式来添加设备。无论如何解决它?如何在重新加载状态之前关闭模态。我使用的引导模式文件profile.html内

enter image description here

+0

是否'profile'国家采取任何PARAMS?另外,为什么不直接从'DeviceService'调用get all device API,而不是重新加载整个页面呢? – Sajal

+0

它看起来像叠加的模式,你使用模式来添加新的设备? –

+0

@Sajal'个人资料'不包含任何参数。因为获取所有设备API在启动状态时运行,所以我想重新加载状态以再次运行。 –

回答

1

尝试以下操作:

$state.reload(); 

,如果将无法正常工作试试这个:

$state.transitionTo($state.current, $stateParams, { 
    reload: true, 
    inherit: false, 
    notify: true 
}); 
+0

我尝试了所有,但他们似乎没有工作。也许这是因为我用来添加设备的模式。 –