我收到这个错误,有什么想法吗?
"Uncaught Error: [$injector:nomod] Module 'route' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument."
我真的不明白。我需要我的模块
module.requires.push("ngRoute");
module.requires.push("route");
angular.module('route') // create new Angular Module
.config(['$routeProvider', function ($routeProvider: angular.route.IRouteProvider) {
$routeProvider.otherwise('/');
$routeProvider
.when('tlob', {
templateUrl: 'partial/layout.html'
})
}]);
在页面顶部我有
///<reference path="../../typings/tsd.d.ts"/>
/// <reference path="../../typings/angularjs/angular-route.d.ts" />
答案 0 :(得分:1)
您的问题就在这一行:
bear
这不会创建模块,只能按名称引用现有模块。如果要在此处创建模块,则需要提供一组其他模块以供参考(即使它是空的)。试试这个:
package test;
public class Main {
public interface MotherI {
// this is static!
public class Embryo {
public void ecluse() {
// NOPE, static context, can't access instance context
// bear(this);
}
}
// implicitly public abstract
void bear(Embryo e);
}
public abstract class MotherA {
public class Embryo {
public void ecluse() {
// ok, within instance context
bear(this);
}
}
public abstract void bear(Embryo e);
}
// instance initializer of Main
{
// Idiom for initializing static nested class
MotherI.Embryo e = new MotherI.Embryo();
/*
* Idiom for initializing instance nested class
* Note I also need a new instance of `Main` here,
* since I'm in a static context.
* Also note anonymous Mother here.
*/
MotherA.Embryo ee = new MotherA() {public void bear(Embryo e) {/*TODO*/}}
.new Embryo();
}
public static void main(String[] args) throws Exception {
// nothing to do here
}
}
并在您使用angular.module('route') // create new Angular Module
后进一步了解
angular.module('route', []) // create new Angular Module