我目前的应用定义如下:
define(['public/js/angular/RouteResolver'], function() {
var app = angular.module('marimba', ['ngRoute', 'routeResolverServices']);
app.config(['$routeProvider', 'routeResolverProvider',
function($routeProvider, routeResolverProvider, $controllerProvider,
$compileProvider, $filterProvider, $provide, $httpProvider) {
//Change default views and controllers directory using the following:
routeResolverProvider.routeConfig.setBaseDirectories('/', '/public/js/angular/controllers/');
//Define routes - controllers will be loaded dynamically
var route = routeResolverProvider.route;
$routeProvider
//route.resolve() now accepts the convention to use (name of controller & view) as well as the
//path where the controller or view lives in the controllers or views folder if it's in a sub folder.
//For example, the controllers for customers live in controllers/customers and the views are in views/customers.
//The controllers for orders live in controllers/orders and the views are in views/orders
//The second parameter allows for putting related controllers/views into subfolders to better organize large projects
//Thanks to Ton Yeung for the idea and contribution
.when('/', route.resolve('Home', 'Home/test'));
}
]);
return app;
});
当我加载以下控制器时,我收到以下错误:
错误:脚本错误:app
'use strict';
define(['app'], function (app) {
});
我做错了什么?我是角色新手,我已将此代码设置为require.js
。我也在使用RouteResolver
以便在路由时动态加载控制器。关于为什么会抛出错误的任何想法?