mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
fix(grunt-utils): ensure special inline CSS works when angular is not a global
The build includes a little script to angular.js, which adds some CSS styles to the page to support things like ngCloak. This script checks that angular is not in CSP mode, but before this fix assumed that angular would be in the global scope. This commit, references `window.angular` instead of just `angular` because when running angular in an environment where the top-level scope is not the window (nodejs for example), we angular is actually a property of `window`. Closes #7176
This commit is contained in:
committed by
Peter Bacon Darwin
parent
7a543c985e
commit
af72f40a55
@@ -136,7 +136,7 @@ module.exports = {
|
||||
.replace(/\\/g, '\\\\')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\r?\n/g, '\\n');
|
||||
js = "!angular.$$csp() && angular.element(document).find('head').prepend('<style type=\"text/css\">" + css + "</style>');";
|
||||
js = "!window.angular.$$csp() && window.angular.element(document).find('head').prepend('<style type=\"text/css\">" + css + "</style>');";
|
||||
state.js.push(js);
|
||||
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user