I'm working in an application that uses Angular-Chart-Js I've added the scripts in my BundleConfig.cs, if the EnableOptimization is set as false, the chart shows correctly, but when I switch the value to false, the chart is not rendered and no JavaScript exception it's shown in the Dev Tools Console.
Bundle:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/angular").Include(
"~/Scripts/angular.js",
"~/Scripts/angular-route.js",
"~/Scripts/angular-local-storage.js"
));
bundles.Add(new Bundle("~/bundles/chart").Include(
"~/Scripts/Chart.js",
"~/Scripts/angular-chart.js"
));
bundles.Add(new ScriptBundle("~/bundles/app").Include(
"~/app/app.js",
"~/app-config.js"
));
bundles.Add(new ScriptBundle("~/bundles/semantic").Include(
"~/Scripts/semantic.js"
));
bundles.Add(new StyleBundle("~/Content/css")
.Include("~/Content/semantic.css",
"~/Content/angular-chart.css",
"~/Content/kendo/kendo.se.css",
"~/Content/App/main.css",
"~/Content/App/login.css"));
Even if I add the .js files directly in the _Layout.cshtml doesn't work if the Optimization is true.
Has anyone faced this issue?
UPDATE
I've tested pulling out from the bundle config my app.js file, then it worked. It seems when the app.js gets minified it does not take the injection.
app.js
'use strict';
var app = angular.module('TheApp', ['chart.js']);
app.config(['ChartJsProvider', function (ChartJsProvider) {
// Configure defaults
}]);
And this is the controller
chartController.js
'use strict';
var app = angular.module('TheApp');
app.controller('ChartController', ['$scope', 'ChartService', function ($scope, chartService) {
//Some stuff working here
}]);
Thanks in advance.
Regards.