カテゴリリストを取得するために注入されたcategoryData $resourceサービスを持つcategoryListControllerからカテゴリのリストをロードするサイドバー(index.html上)を備えたSPAに角度ルーティングを使用しています。
それから、categoryData $resource サービスも使用する addCategoryController の助けを借りてカテゴリを追加するテンプレート addCategory.html があります。
$scope.categories = categoryData.query(); //categoryListController (for sidebar)
categoryData.save(newCategory) // on addCategoryController (for addCategory.html)
問題は、ページ全体を更新しない限りサイドバーが更新されないことです。どうにかして categoryListController を更新するように指示する必要があると考えていますが、その方法がわかりません。$scope.categories.push(newCategory) を categoryData.save(newCategory) の直後に実行して、新しいカテゴリを addCategory.html にすぐに表示することができますが、これが何かでない限り、それが私のサイドバーの答えだとは思いません$rootscope で処理する必要がありますか? わからない。ありがとう