Home > Web Front-end > JS Tutorial > Solution to error reported after angularjs uses gulp-uglify compression

Solution to error reported after angularjs uses gulp-uglify compression

亚连
Release: 2018-05-31 17:50:51
Original
2322 people have browsed it

Below I will share with you a solution to the error report after angularjs uses gulp-uglify compression. It has a good reference value and I hope it will be helpful to everyone.

The reason for the problem is that after compression, the variables become e, s, t, etc. The methods that require dependency injection do not use square bracket injection, but are used directly in the parameters of the function, resulting in unrecognizable after compression. Modules that require dependency injection. For example:

var module= angular.module('homeApp', ['ui.router']); 
module.config(function ($sceProvider) { 
 $sceProvider.enabled(false); 
})
Copy after login

is changed to:

var module= angular.module('homeApp', ['ui.router']); 
module.config(['$sceProvider',function ($sceProvider) { 
 $sceProvider.enabled(false); 
}])
Copy after login

After using gulp-uglify compression again, the execution is normal.

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Using Axios Element to implement global request loading

Select selector multi-selection verification method in iview

nodejs example of how to connect to mongodb database

The above is the detailed content of Solution to error reported after angularjs uses gulp-uglify compression. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template