我试图将我的angular2应用设置为AOT。似乎为此app.module.ngfactory.ts需要一个文件,而不是app.module.ts用于JIT编译的标准文件。我正在app.module.ts为我的标准JIT应用程序工作。我该如何将该文件的内容转换为预期的格式app.module.ngfactory.ts?
我有变量
var dataValue = '10/2019'
,我想在不同的变量中得到2019和10的值.所以我有var dataA = 10, and var dataB = 2019
如何解决这个问题?
我在网上找到了动画代码,当我点击图像时,它会再次播放动画来说明部分。我想做的是当我单击图像时它会播放动画并停止动画再次单击它应该重置图像,任何人都给我反馈如何做到这一点..
.like-btn-svg {
width: 80px;
height: 100px;
position: absolute;
left: 25px;
bottom: -112px;
transform: translate(-50%, -50%);
background: url(https://abs.twimg.com/a/1446542199/img/t1/web_heart_animation.png) no-repeat;
background-position: 0 0;
animation: fave-like-btn-svg 1s steps(28);
cursor: pointer;
}
.like-btn-svg:hover {
background-position: -2800px 0;
transition: background 1s steps(28);
}
@keyframes fave-like-btn-svg {
0% {
background-position: 2800px 0;
}
100% {
background-position: -2800px 0;
}
}Run Code Online (Sandbox Code Playgroud)
<div class="like-btn-svg"></div>Run Code Online (Sandbox Code Playgroud)
请在下图中找到代码.1.将函数的返回值(实际上抛出一个错误)分配给使用关键字"let"声明的变量'withLet'.2.调用'withLet',发生错误:'withLet未定义'.3.尝试使用'let'断言'withLet',错误显示已经声明'withLet'.
但是'var'不存在悖论(请参见下图).
我很好奇是什么导致了这两种情况之间的不同行为.它是非常有线的,"未定义","已经声明"描述了一个相同的变量.
let withLet = (function() {throw 'error!'})()
var withVar = (function() {throw 'error!'})()
//VM2470:1 Uncaught error!
//(anonymous) @ VM2470:1
//(anonymous) @ VM2470:1
withLet
//VM2484:1 Uncaught ReferenceError: withLet is not defined at
//<anonymous>:1:1
//(anonymous) @ VM2484:1
withVar
//undefined
let withLet = 'sth'
//VM2520:1 Uncaught SyntaxError: Identifier 'withLet' has already been
//declared
//at <anonymous>:1:1
//(anonymous) @ VM2520:1
withVar = 'sth'
//"sth"
Run Code Online (Sandbox Code Playgroud)
截图:

我有如下数组
[
{
"WarehouseId": 1,
"ShippingCarrierId": 1,
"PostalCodeType": "ShipToCustomer",
"TimeStart": "1970-01-01T06:00:00.000Z",
"TimeEnd": "1970-01-01T15:59:00.000Z",
"PickupTimeSlot": "PM",
"DaysToAdd": 0,
"PickupTime": "1970-01-01T17:00:00.000Z"
},
{
"WarehouseId": 1,
"ShippingCarrierId": 1,
"PostalCodeType": "ShipToCustomer",
"TimeStart": "1970-01-01T16:00:00.000Z",
"TimeEnd": "1970-01-01T23:59:00.000Z",
"PickupTimeSlot": "AM",
"DaysToAdd": 1,
"PickupTime": "1970-01-01T11:00:00.000Z"
},
{
"WarehouseId": 1,
"ShippingCarrierId": 1,
"PostalCodeType": "ShipToCustomer",
"TimeStart": "1970-01-01T00:00:00.000Z",
"TimeEnd": "1970-01-01T05:59:00.000Z",
"PickupTimeSlot": "AM",
"DaysToAdd": 0,
"PickupTime": "1970-01-01T11:00:00.000Z"
},
{
"WarehouseId": 2,
"ShippingCarrierId": 2,
"PostalCodeType": "ShipToCustomer",
"TimeStart": "1970-01-01T00:00:00.000Z",
"TimeEnd": "1970-01-01T15:59:00.000Z",
"PickupTimeSlot": "PM",
"DaysToAdd": 0,
"PickupTime": "1970-01-01T17:00:00.000Z"
},
{
"WarehouseId": 2,
"ShippingCarrierId": 2,
"PostalCodeType": …Run Code Online (Sandbox Code Playgroud) angular typescriptObject和objectangular typescript 有什么区别
我收到一个 tslint 错误:
不要使用“对象”作为类型。避免使用
Object类型。你的意思是object?
Consider the following code.I’m not sure I completely understand lexical scoping, but, unless I’m misinterpreting everything I’ve been reading, an inner function can only reference outer variables that have been declared in the same context.
let a = 7;
function test() {
return a;
}
function test2() {
let a = 5;
return test()
}
console.log(test2())Run Code Online (Sandbox Code Playgroud)
In other words, what matters is where such functions are born and NOT where they are called, which, in the case of my example …
因此,我只是在玩javascript,我在类的构造函数之前被调用了一个带有类的类。
class SomeClass {
constructor() {
console.log('Constructor Called.');
};
someIife = (() => {
console.log('iife called');
return () => { }
})()
};
const someClass = new SomeClass();Run Code Online (Sandbox Code Playgroud)
输出是-
ife妇叫
构造函数称为。
这是设计使然吗?我不确定发生了什么。
似乎真的很有趣,请有人解释为什么会这样。
谢谢。
<YAxis
orientation="right"
// YAxis={{
// tickFormatter: (Estimated_minutes) =>
// parseFloat(Estimated_minutes).toFixed(0),
// }}
formatter={formatYAxis}
type="number"
yAxisId="2"
dataKey="Estimated_minutes"
fill="#000000"
/>
Run Code Online (Sandbox Code Playgroud)
如何格式化 中的整数值Yaxis?我已经尝试过toFixed,但它仍然给我错误。我还有其他方法可以实现这个吗?
我必须为正态分布图对数组进行排序,因此它的值必须从最小值到最大值排序,然后再回到最小值,从而创建一条曲线。
例子:
大批:
[200, 300, 0, 100, 400]
Run Code Online (Sandbox Code Playgroud)
必须如何排序:
[0, 100, 200, 300, 400, 300, 200, 100, 0]
Run Code Online (Sandbox Code Playgroud)
关于如何在 Javascript 中执行此操作的任何想法?