I am using Angular 2.
我正在使用Angular 2。
When I use this in SCSS file, it works well.
当我在SCSS文件中使用它时,它运行良好。
.text::after {
content: "\00a0\00a0";
}
However, when I move it in
但是,当我搬进去的时候
styles: [``]
It shows:
Uncaught SyntaxError: Octal literals are not allowed in strict mode.
未捕获的SyntaxError:严格模式下不允许使用八进制文字。
I know codes in styles: [``]
needs to be CSS codes.
我知道样式中的代码:[``]需要是CSS代码。
And I tried
我试过了
styles: [`
.text::after {
content: " ";
}
`]
But then the screen shows
directly. How can I write it correctly?
但随后屏幕显示 直。我该怎么写得正确?
1 个解决方案
#1
20
You need to escape it
你需要逃脱它
.text::after {
content: "\\00a0\\00a0"; // now it's just a simple plain string
}
"use strict" is a new feature introduced in JavaScript 1.8.5 (ECMAScript version 5).
“use strict”是JavaScript 1.8.5(ECMAScript版本5)中引入的新功能。
In which,
- Octal numeric literals are not allowed
- Escape characters are not allowed
- see more...
不允许使用八进制数字文字
不允许使用转义字符
#1
20
You need to escape it
你需要逃脱它
.text::after {
content: "\\00a0\\00a0"; // now it's just a simple plain string
}
"use strict" is a new feature introduced in JavaScript 1.8.5 (ECMAScript version 5).
“use strict”是JavaScript 1.8.5(ECMAScript版本5)中引入的新功能。
In which,
- Octal numeric literals are not allowed
- Escape characters are not allowed
- see more...
不允许使用八进制数字文字
不允许使用转义字符