简体   繁体   中英

How To config $routeProvider with 'app.config' no longer in Express 4? (Angular JS)

The problem I'm having is app.config is said to be the only block where $routeProvider can be called. With Express 4 removing app.config, how should it be called now?

Previously:

    var app = angular.module('sampleApp', ['ngRoute']);

app.config(['$routeProvider', function($routeProvider){
    $routeProvider
        .when('/', {
            templateUrl: 'partials/home.html'
        })
        .otherwise({
            redirectTo: '/'
        });
}]);

Express 4 is now asking that we use process.env.NODE_ENV to configure, if so, how would this be rewritten?

Are there other ways?

Thank you!

Took me too long to realize I don't really have a problem here. I just downgraded my Express version. If anybody comes across this looking for answers too, unless you're dependent on something in Express 4 just downgrade. duh facepalm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM