How can have multiple Modules without repeat injections

家住魔仙堡 提交于 2020-01-05 08:43:45

问题


I have 2 applications app1 & app2

app1.js

var app = angular.module("app1", ["ngRoute"]);

app.config(['$routeProvider', function ($routeProvider) {
   $routeProvider.when('/view3', {
    templateUrl: 'http://localhost:40/partials/partial3.html',
    controller: 'MyCtrl1 as self'
   });

   $routeProvider.otherwise({
    redirectTo: '/view3'
   });
}]);

app1 has ngRoute module, and route config

app2.js

var app = angular.module("app2", ["app1"]);

app2 has app1 module


Note: app1 run in localhost:40 & app2 in localhost:50.

Question is: How can use app1 route configs without inject ngRoute in app2?

i run app2 with requirejs & it works if i inject ngRoute in app2.

来源:https://stackoverflow.com/questions/48050001/how-can-have-multiple-modules-without-repeat-injections

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!