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