This time I will bring you how to solve the file error after compression in angularjs. What are the precautions to solve the problem of file error after compression in angularjs. The following is a practical case. Let’s take a look. one time.
The reason for the problem is that after compression, variablesbecome,e,s,t,etc., the method that requires dependency injection does not use square bracket injection, and in Used directly in function parameters, resulting in the inability to identify modules that require dependency injection after compression. For example:
var module= angular.module('homeApp', ['ui.router']); module.config(function ($sceProvider) { $sceProvider.enabled(false); })
is changed to:
var module= angular.module('homeApp', ['ui.router']); module.config(['$sceProvider',function ($sceProvider) { $sceProvider.enabled(false); }])
After using gulp-uglify compression again, the execution is normal.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to implement the starry navigation bar in JS
How vue and vue-i18n implement background data Multi-language switching
The above is the detailed content of How to solve file error after angularjs compression. For more information, please follow other related articles on the PHP Chinese website!