问题
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'
});
}]);
app1hasngRoutemodule, and route config
app2.js
var app = angular.module("app2", ["app1"]);
app2hasapp1module
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
app2withrequirejs& it works if i injectngRouteinapp2.
来源:https://stackoverflow.com/questions/48050001/how-can-have-multiple-modules-without-repeat-injections