Im trying to integrate AngularJS+RequireJS to make a Phonegap project. I have all running on PC but when I build project in Phonegap I have these errors in LogCat:
05-07 13:55:38.008: E/Web Console(10987): Uncaught Error: Script error for: angular 05-07 13:55:38.008: E/Web Console(10987): http://requirejs.org/docs/errors.html#scripterror at file:///android_asset/www/libs/require.js:138
05-07 13:55:45.058: E/Web Console(10987): Uncaught Error: Load timeout for modules: ui.router 05-07 13:55:45.058: E/Web Console(10987): http://requirejs.org/docs/errors.html#timeout at file:///android_asset/www/libs/require.js:138
The Index.html
<script src="libs/require.js"></script>
<script>
require(['require', './js/config-require'], function (require, config) {
config.urlArgs = 'bust=v0.4.0';
window.require.config(config);
require(['./js/main.js']);
});
</script>
config-require.js
define({
paths: {
'angular' : '../libs/angular',
'async' : '../libs/async',
'domReady' : '../libs/domReady',
'ngResource' : '../libs/angular-resource',
'ui.router' : '../libs/angular-ui-router'
},
shim: {
'angular': {
'exports': 'angular'
},
'ngResource': ['angular'],
'ui.router' : ['angular']
}
});
main.js
define([
'require',
'angular',
'./app'
], function (require, angular) {
'use strict';
require(['domReady!'], function (document) {
angular.bootstrap(document, ['app']);
});
});
app.js
define([
'angular',
'ui.router',
'./config',
'./modules/home/index'
], function (ng) {
'use strict';
return ng.module('app', [
'app.constants',
'app.home',
'ui.router'
]).config(['$urlRouterProvider', function ($urlRouterProvider) {
$urlRouterProvider.otherwise('/');
}]);
});
Anyone can help me to configure it?
require.js
in a phonegap project? – TheHippo