如何使用Dojo与Angular2?

cbwuti44  于 2022-12-16  发布在  Dojo
关注(0)|答案(1)|浏览(166)

我尝试让一个简单的dojo模块与angular2一起工作。但是,我无法同时加载angular2库和dojo库。我尝试先加载dojo,然后再加载angular,反之亦然,但都无济于事。以下是我尝试的方法:
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>

错误:
404(未找到页面)
404(未找到页面)
我是相当新的Angular ,所以所有的帮助是赞赏。

xzabzqsa

xzabzqsa1#

404(找不到文件)找不到文件
这是由以下代码触发的:

import dom = require("dojo/dom");
import fx = require("dojo/fx");
  • 确保已安装dojo *🌹

相关问题