javascript - Reusable factory -
i have such simple code, want have reusable factory
can use across multiple ng-app
.
var app1 = angular.module("xxx", []) .factory("yyy", function () { console.log("yyy"); }); var app = angular .module("operations", ["ngroute", "ui.bootstrap", "cgbusy", "xxx"]) .config(carsappconfig) .constant("events", events) .run(function ($rootscope){ $rootscope.handleerrors = handleerrors; }); carsappconfig.$inject = ["$httpprovider", "$locationprovider", "$routeprovider", "yyy"]; function carsappconfig($httpprovider, $locationprovider, $routeprovider, yyy) { $httpprovider.defaults.transformresponse.push(function (responsedata) { convertdatestringstodates(responsedata); return responsedata; });
but complains cannot create operations module because cannot find yyy
dependency.
using angular 1.10.2
. did changed in angular prohibits such constructions?
thx
Comments
Post a Comment