Reputation: 531
I am adding jquery using requireJS like
requirejs.config({
enforceDefine: true,
paths: {
jquery: 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min'
}
});
Later in seperate JS file I am loading on page using require as
require(['jquery'], function ($) {
//Do something with $ here
}, function (err) {});
I gave jquery URL incorrectly and want to show some custom err message to end user..I added above code but when URL is incorrect the control is not coming inside err function..Do I want to add any other code..I am using for DOJO version.
Upvotes: 0
Views: 507
Reputation: 44685
It seems you're using the Dojo AMD loader, they have a different approach of handling errors.
While in RequireJS you would use:
require([ 'jquery' ], function($) {
// Do something with $ here
}, function(err) {
// Error handling
});
In Dojo you would use a different syntax, for example:
require.on('error', function(err) {
// Error handling
});
require([ 'jquery' ], function($) {
// Do something with $ here
});
An example: http://plnkr.co/edit/t3j7mTgLKSiTCIrvl2eD?p=preview
However, since you're using Dojo, the requirejs.config()
does probably not work either if you're working the Dojo AMD loader.
Upvotes: 3