Closed vwal closed 10 years ago
Are you using beta 5 or a pull from master? What is the templates
module?
It was installed with bower.
I should also mention that in this case the scripts go through a minification process, which could be cause for the trouble, I haven't investigated it yet. I'm using a Yeoman scaffold (generator-ghurt) for Angular front end / hapijs back-end, and "templates" is a structure generated by it. It is imported in app.js:
'use strict';
angular.module('app', ['templates', 'common', 'ngRoute', 'ngAnimate'])
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/app.view.html',
controller: 'AppCtrl'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
}])
.controller('AppCtrl', ['$scope', function ($scope) {
$scope.message = 'Hello World';
$scope.templateUrl = 'app/app.view.html';
}
]);
angular.module('templates', ['app/app.view.html']);
angular.module('app/app.view.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('app/app.view.html',
'<h1>{{message}}</h1>');
}]);
So it seems the second round of minification is the problem. I pulled classy from a CDN (//cdn.jsdelivr.net/angular.classy/0.4.2/angular-classy.min.js
) and the problem went away. The scaffold includes a Grunt script that does the automatic build that includes minification, so I'll have to see how to exclude specific vendor scripts from minification (especially since it is already minified).
Well 0.4.2 is a different version so that may not necessarily be the problem. Try this version from the rawgit CDN: https://rawgit.com/davej/angular-classy/6ae36fad10c2477d07f12b3f99ac31a1048ec46f/angular-classy.min.js
Ah, you're right.. the problem returned with that version. :-/
Hmm, it definitely works with 1.3 because I have it running with 1.3 on a personal site.
I have a feeling that it might be a conflict between Classy and those funny module names that the template module creates (e.g. 'app/app.view.html'
). Give me 10 minutes to look into this and see if I can figure it out.
Could you tell me if this version works: https://rawgit.com/davej/angular-classy/32b774c551c36d66f9688f6a2ecf3f0132d2ba9e/angular-classy.min.js
I have identified the issue and it is indeed a Classy bug related to lazy-loaded requires in module definitions. It will be fixed for beta 6, which will be released on Tuesday or Wednesday. For the moment, you can roll back to beta 4 which should work fine.
bower install angular-classy#1.0.0-beta.4
Good bug-catching by the way :-)
Yes, beta4 seems to work! :-) Thanks for the quick assessment of the issue (and yay.. it wasn't just me abusing the script! :-D).
Beta 6 released, so you can now bower install it.
https://github.com/davej/angular-classy/releases/tag/v1.0.0-beta.6
Cool! It works! Thanks for the quick fix!!
It seems angular-classy does not like at least the final release of AngularJS 1.3.0 (I haven't tested with the release candidates). When I attempt to load angular-classy with 1.3.0, the console spits out bunch of issues:
I've tried both the stable and the beta versions of classy with the same result.
The scripts loaded in this particular case are as follows:
Disabling angular-classy gets rid of the error.