dojo - How to set Arcgis Javascript dojoConfig relative path of packages - Stack Overflow

I am using Arcgis Javascript API. API is built on dojo toolkit. So I need to use dojo features in API.

I am using Arcgis Javascript API. API is built on dojo toolkit. So I need to use dojo features in API. I am preparing dojo config file as following.

var pathRegex = new RegExp("/\/[^\/]+$/");
var locationPath = location.pathname.replace(pathRegex, '');

var dojoConfig = {
    async: true,
    parseOnLoad: false,
    baseUrl:"js/",
    packages: [
    {
        name: "application",
        location: locationPath + '/js/application'
    }]    
};

I created a bootstrapper.js like following.

require(["application/main", "dojo/domReady!"], function (application) {
    console.log("bootstrapper is running");

    application.Run();
})

And index.html file is like this.

<!DOCTYPE html>
<html xmlns="">
    <head>
        <title>Arcgis Javacsript API Samples</title>

        <link rel="stylesheet" href=".5/js/dojo/dijit/themes/claro/claro.css">
        <link rel="stylesheet" href=".5/js/esri/css/esri.css">
    </head>

    <body class="claro">
        <div id="map"></div>

        <script src="//js.arcgis/3.6/"></script>
        <script src="js/application/djConfig.js"></script>
        <script src="js/application/bootstrapper.js"></script>
    </body>
</html>

My application is hosted on IIS and has addres like this htp://domain/Demo/Sample1/index.html

when I run application, this code giving error like following.

"NetworkError: 404 Not Found - .6/js/dojo/application/main.js"

If I set bootstrapper.js file as following, problem is solwing.

require(["js/application/main.js", "dojo/domReady!"], function (application) {
    console.log("bootstrapper is running");

    application.Run();
})

I am using Arcgis Javascript API. API is built on dojo toolkit. So I need to use dojo features in API. I am preparing dojo config file as following.

var pathRegex = new RegExp("/\/[^\/]+$/");
var locationPath = location.pathname.replace(pathRegex, '');

var dojoConfig = {
    async: true,
    parseOnLoad: false,
    baseUrl:"js/",
    packages: [
    {
        name: "application",
        location: locationPath + '/js/application'
    }]    
};

I created a bootstrapper.js like following.

require(["application/main", "dojo/domReady!"], function (application) {
    console.log("bootstrapper is running");

    application.Run();
})

And index.html file is like this.

<!DOCTYPE html>
<html xmlns="http://www.w3/1999/xhtml">
    <head>
        <title>Arcgis Javacsript API Samples</title>

        <link rel="stylesheet" href="http://serverapi.arcgisonline./jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css">
        <link rel="stylesheet" href="http://serverapi.arcgisonline./jsapi/arcgis/3.5/js/esri/css/esri.css">
    </head>

    <body class="claro">
        <div id="map"></div>

        <script src="//js.arcgis./3.6/"></script>
        <script src="js/application/djConfig.js"></script>
        <script src="js/application/bootstrapper.js"></script>
    </body>
</html>

My application is hosted on IIS and has addres like this htp://domain/Demo/Sample1/index.html

when I run application, this code giving error like following.

"NetworkError: 404 Not Found - http://js.arcgis./3.6/js/dojo/application/main.js"

If I set bootstrapper.js file as following, problem is solwing.

require(["js/application/main.js", "dojo/domReady!"], function (application) {
    console.log("bootstrapper is running");

    application.Run();
})

Share Improve this question edited Aug 10, 2016 at 20:59 Kstro21 7,83114 gold badges64 silver badges97 bronze badges asked Sep 10, 2013 at 8:51 bartelomabarteloma 6,88516 gold badges94 silver badges209 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Try to change your script order in index.html file. Your config settings should load before CDN.

    <div id="map"></div>

    <script src="js/application/djConfig.js"></script>
    <script src="//js.arcgis./3.6/"></script>
    <script src="js/application/bootstrapper.js"></script>
</body>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745620825a4636504.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信