2016-05-05 14 views
0

リンクをクリックした後、viewAll.htmlというテンプレートにルーティングする角型アプリケーションがあります。

このページには、範囲変数を使用してAJAX経由でデータが入力されています。

問題は、AJAX経由でこれらのスコープ変数を更新してレンダリングしようとすると、そのページが空白になることです。テンプレートは読み込まれません。

$http({ 
    method: 'post', 
    url: appContext('MarkMessageAsReadV2.json'), 
    data: { 
     "customerNotificationId":"", 
     "isRead":"Y", 
     "channelTypeCode":"101", 
     "readAll":"Y", 
     "customerType": "A" 
    } 
}).success(function (data) { 
    $http.post(appContext('ViewAllNotificationsV2.json'), { 
      "categoryGroupType":"ROLB", 
      "isArchived":"N", 
      "channelTypeCode":"101", 
      "limit":"20", 
      "page":"0", 
      "customerType": "A" 
     }).success(function(content, status, headers, config) { 
      $scope.notifications = content.all.notification; 
      $scope.personalNotifications = content.personal.notification; 
      $scope.businessNotifications = content.business.notification; 
     }).error(function(data, status, headers, config) { 
      // log error 
     }); 
}).error(function (a, b, c) { 
     console.log(a, b, c); 
}); 
+0

後scope.apply $()を使用する:ここで

は、コードのですか? エラーがありますか? – OBender

+0

その変数がhtmlテンプレートやコントローラのスコープ外の部分を読み込もうとしているかどうかチェックできますか?私は、コントローラからスコープの外にhtmlをレンダリングした場合、スコープを台無しにして空白の画面を表示することはほとんどありませんでした。 – Rahul

+0

あなたの約束を繋ぐ理由はありますか? '$ http.post(/ * get notifications * /)'は、前回の約束のデータの返還に依存していないことに気付きました。 – Kyle

答えて

0

試みあなたがコンソールに表示どのようなスコープ変数

$scope.notifications = content.all.notification; 
$scope.personalNotifications = content.personal.notification; 
$scope.businessNotifications = content.business.notification; 
$scope.$apply(); 
+0

$ http promise chainがダイジェスト中に実行されますが、$ applyまたは$ digestの場所はありません。 – estus

関連する問題