Note that there are some explanatory texts on larger screens.

plurals
  1. PODefining multi layer dependencies using require.js
    primarykey
    data
    text
    <p>I am creating a small web framework using AngularJS, Bootstrap and Jquery. I will be adding several reusable angular directives in this framework. This framework will be used by several other web applications. This is the structure</p> <pre><code>WebApp1 |-js | |_testFramework.js | |_lib | | |_angular.min.js | | |_bootstrap.min.js | | |_jquery.min.js | |_main.js | |_require.js | |_controllers.js |_index.html </code></pre> <p>my testFramework.js looks like this</p> <pre><code>require.config({ paths: { jquery: 'lib/jquery.min', angular:'lib/angular.min', bootstrap:'lib/bootstrap.min', }, shim: { 'angular' : {exports:'angular'}, } }); define(['angular'],function(angular){ console.log('framework loaded'); var fw = angular.module("framework",[]); ff.directive("dir1",function(){ }.directive("dir2",function(){ } } </code></pre> <p>My Main.js is as below</p> <pre><code>require.config({ paths: { fw: 'framework', controllers: 'controllers' } }); define(['fw','angular'], function(fw, angular){ var app = angular.module("myWebApp1",['fw']); $routeProvider.when('/login',{templateUrl:'partials/login.html'}); $routeProvider.otherwise({redirectTo: '/login'}); }]) console.log('app loaded'); } ); </code></pre> <p>Index.html has </p> <pre><code>&lt;script data-main="js/main.js" src="js/require.js"&gt;&lt;/script&gt; </code></pre> <p>But I always get this below error when I try to load the app</p> <pre><code>"NetworkError: 404 Not Found - https://localhost:8000/WebApp1/js/angular.js" </code></pre> <p>Why is it trying to load angular from /js, instead of what is mentioned in the testFramework.js</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload