我正在尝试使用一个简单的dojo模块来处理angular2。 但是,我无法加载angular2库和dojo库。 我试图首先加载dojo然后加载角度,反之亦然无效。这是我尝试过的:
main.ts
/// <reference path="typings/dojo/dojo.d.ts"/>
/// <reference path="typings/angular2/angular2.d.ts"/>
import {Component, View, bootstrap} from 'angular2/angular2';
declare var require: (moduleId: string) => any;
import dom = require("dojo/dom");
import fx = require("dojo/fx")
@Component({
selector: 'greeting'
})
@View({
template: `<div id="innergreeting">Hello From Angular and</div>`
})
class DojoTest{
constructor(){
var greeting = dom.byId("innergreeting");
greeting.innerHTML += ' Dojo!';
fx.slideTo({
node: greeting,
top: 100,
left: 200
}).play();
}
}
bootstrap(DojoTest);
的index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial: Hello Dojo!</title>
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="https://jspm.io/system@0.16.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"></script>
</head>
<body>
<greeting></greeting>
<script>System.import('main');</script>
</body>
</html>
ERROR:
获取http://localhost:8080/dojo/dom.js 404(未找到)
获取http://localhost:8080/dojo/fx.js 404(未找到)
我是AngularJs的新手,所以非常感谢所有人的帮助。
答案 0 :(得分:0)
获取http://localhost:8080/dojo/dom.js 404(未找到) 获取http://localhost:8080/dojo/fx.js 404(未找到)
这由以下代码触发:
import dom = require("dojo/dom");
import fx = require("dojo/fx");
确保您已安装dojo