angular-datetime icon indicating copy to clipboard operation
angular-datetime copied to clipboard

MVC Bundling Problem

Open Neilski opened this issue 11 years ago • 2 comments

I am running AngularJS/angular-datetime (latest build) in a legacy ASP.net MVC 5 application. Within the application, all page script management is handled by the MVC ScriptBundle manager.

With ScriptOptimisation turned off, angular-datetime works perfectly, but with the ScriptOptimisation turned on I get the following error when the datetime attribute is referenced in the view:

Error: [$injector:unpr] http://errors.angularjs.org/1.3.15/$injector/unpr?p0=nProvider%20%3C-%20n%20%3C-%20datetimeDirective

I am new to AngularJS, but I am guessing this is a problem related to parameter name changing during the script bundling/minification process?

Finally, thank you for taking the time to build this extension - it addresses my needs perfectly.

Neilski avatar May 20 '15 09:05 Neilski

I think I may have resolved the problem by wrapping the main entry point methods as follows:

angular.module("datetime").factory("datetime", ['$locale', function ($locale) { ... }]);

and

angular.module("datetime").directive("datetime", ['datetime', '$log', function (datetime, $log) { ... }]);

But, as I say, I am new to AngularJS so this might be 'hacky'.

Neilski avatar May 20 '15 12:05 Neilski

It's not hacky. Actually it's recommended to release all code using explicit annotation.

I will add ng-annotate to the build process.

eight04 avatar May 21 '15 03:05 eight04