3
votes

I am trying to get a simple dojo module to work with angular2. However, I am not able to load both the angular2 libraries and the dojo libraries. I have tried to load dojo first then angular and vice versa to no avail. Here is what I have tried:

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/[email protected]/traceur-runtime.js"></script>
    <script src="https://jspm.io/[email protected]"></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:

GET http://localhost:8080/dojo/dom.js 404 (Not Found)

GET http://localhost:8080/dojo/fx.js 404 (Not Found)

I am fairly new to AngularJs so all help is appreciated.

1

1 Answers

0
votes

GET http://localhost:8080/dojo/dom.js 404 (Not Found) GET http://localhost:8080/dojo/fx.js 404 (Not Found)

This is triggered by the following code:

import dom = require("dojo/dom");
import fx = require("dojo/fx");

Make sure you have dojo installed 🌹