Członkowie prywatni modułu kątowego

W AngularJS możliwe jest tworzenie prywatnych kontrolerów lub usług, które mogą być używane w module, w którym są zdefiniowane, ale nie przez inny moduł, do którego są wprowadzane.

Na przykład, czy PrivateController może stać się prywatnym modułem Child:

angular.module('Child', [])

  .controller('PublicController', function ($scope){
    $scope.children = ['Bob', 'Sue'];

  })

  .controller('PrivateController',function ($scope){
    $scope.redHeadedStepChildren = ['Billy', 'Mildred'];

  })

angular.module('Parent', ['Child'])
<div ng-app="Parent">
    <div ng-controller='PublicController'>
        <div ng-repeat='child in children'>
                 {{child}}
        </div>
    </div>

    <div ng-controller='PrivateController'>
        <div ng-repeat='child in redHeadedStepChildren'>
                 {{child}}
        </div>
    </div>
</div>

questionAnswers(2)

yourAnswerToTheQuestion