How to create a private factory in angularjs?

I use factory for myapp, is it possible to create a private factory in angular js.

module.factory('ParentService', function ($q, $http) { return { //public API }; }); module.factory('ChildService', function (ParentService, $sce) { var child = Object.create(ParentService); child.childMethod = function () { //extending the parent }; return child; }); 

I want my ParentService to be private so that the other controller does not have access to it.

+1
source share
1 answer

You cannot create them in AngularJS 1.x. In the future there may be services / factories with modules, but no one has implemented them yet.

+1
source

Source: https://habr.com/ru/post/982902/


All Articles