Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d423117

Browse files
tomyam1petebacondarwin
authored andcommitted
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
1 parent 3c8a940 commit d423117

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/grunt/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136
.replace(/\\/g, '\\\\')
137137
.replace(/'/g, "\\'")
138138
.replace(/\r?\n/g, '\\n');
139-
js = "!angular.$$csp() && angular.element(document).find('head').prepend('<style type=\"text/css\">" + css + "</style>');";
139+
js = "!window.angular.$$csp() && window.angular.element(document).find('head').prepend('<style type=\"text/css\">" + css + "</style>');";
140140
state.js.push(js);
141141

142142
return state;

0 commit comments

Comments
 (0)