如何在Kibana 4中排除多个搜索字词?如果我只键入一个术语,则将其排除在外...但我怎样才能有多个被排除的术语.例如,术语"尚未分类"
在angular指令的编译函数中有一个pre和post.这个前置和后置真的和链接功能一样吗?
例如,在下面的代码中,链接函数是否相同(如果你愿意,则为快捷方式)作为下面的编译函数的前置和后置?
链接
....
link: {
pre: function(scope, elem, attr) {
//stuff
},
post: function(scope, elem, attr) {
//stuff
}
}
....
Run Code Online (Sandbox Code Playgroud)
编译...
....
compile: function(tElem, tAttrs){
return {
pre: function(scope, iElem, iAttrs){
//stuff
},
post: function(scope, iElem, iAttrs){
//stuff
}
}
}
.....
Run Code Online (Sandbox Code Playgroud) javascript angularjs angularjs-directive angularjs-scope angularjs-ng-repeat
我使用Github页面部署了一个个人博客,我看到一些教程告诉你创建一个gh-pages分支.我这样做了,但是,只有当我对我的主人做出更改时,我才能看到对网站的更改.所以,我很困惑为什么我需要gh页面?有人可以解释一下.谢谢
我有一些JSON对象数组中的数据.我正在尝试使用嵌套的forEach循环来提取数据.
数据的建模类似于belo.dataModels中有多个dataModel和多个childNodes.
//this is what an example data looks like
dataModels[0].childNodes[0].appId
Run Code Online (Sandbox Code Playgroud)
我想尝试做以下事情:
dataModels.forEach(function(entry){
entry.forEach(function(childrenEntry){
console.log(childrenEntry.appId);
})
})
Run Code Online (Sandbox Code Playgroud)
但上面的方法不起作用,它给我一个错误,说"入口"不是一个功能.有没有更好的方法来实现我想要做的事情?
我正在尝试检查isDST()(如果启用夏令时,则返回true或false)。如果我使用当前日期时间,则效果很好-例如,var isdst = moment()。isDST()对于我的时区返回true。但是,我要做的是先设置时区偏移,然后检查夏令时是否在该时区中处于活动状态。我下面有以下代码。
var isdst = moment('2014-03-28').zone('+01:00');
console.log('daylight savings for +0100 is ' + isdst); //returns true when it should return false
Run Code Online (Sandbox Code Playgroud)
如果您查看+0100时区(欧洲联盟国家)的夏令时,该日期直到2014年3月30日才生效。但是,上面的代码实际上在3月28日才返回true,但实际上不应该(直到2天后)。您可以在http://www.worldtimezone.com/daylight.html上查看其他国家/地区的DST 。
我进行了更多测试,似乎代码在运行时考虑了我自己的时区(美国东部标准)。如果您在上面看到网站,那么东部标准夏令时将从2014年3月9日开始。如果我在3月9日之前的几天测试代码,则返回false(即3月8日)。如果我在3月11日进行测试,则返回true。这告诉我,它没有考虑区域(“ +0100”),而是以某种方式使用了我的时区...为什么?如何设置momentjs日期的时区?我查看了文档(http://momentjs.com/docs/),它说这是正确的方法,但是对我不起作用。
我有下面的CSS,它创建一个按钮,但我希望有透明效果(并略微看到后面的背景).请注意,我不希望它完全透明,完全不可见.只是一点点......
我曾尝试弄乱"不透明度",但这只会模糊图像并扭曲颜色.
.i2Style {
font:bold 20px"Arial Black", Gadget, sans-serif;
font-style:normal;
color:#ffd324;
background:#158edb;
border:0px solid #4a3a00;
text-shadow:0px -1px 1px #222222;
box-shadow:0px 0px 12px #2e2300;
-moz-box-shadow:0px 0px 12px #2e2300;
-webkit-box-shadow:0px 0px 12px #2e2300;
border-radius:15px 15px 15px 15px;
-moz-border-radius:15px 15px 15px 15px;
-webkit-border-radius:15px 15px 15px 15px;
width:87px;
padding:20px 46px;
cursor:pointer;
margin:0 auto;
}
.i2Style:active {
cursor:pointer;
position:relative;
top:2px;
}
Run Code Online (Sandbox Code Playgroud) 我有一个名为“host”的模块,它有自己的路由,我想将其插入到 app-routing.module 中。但是,我遇到了首先加载通配符并显示 PageNotFoundComponent 的问题,而不是加载 Host 组件。我有以下文件。
主机模块.ts
....
const routes: Routes = [
{
path: 'host',
children: [
{ path: '', component: HostComponent }
]
}
];
@NgModule({
declarations: [HostComponent],
imports: [
CommonModule,
RouterModule.forChild(routes)
]
})
export class HostModule { }
Run Code Online (Sandbox Code Playgroud)
应用程序路由.module.ts
const routes: Routes = [
{ path: '', component: HomeComponent, pathMatch: "full"},
{ path: '**', component: PageNotFoundComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)
应用程序模块.ts
@NgModule({
declarations: [
AppComponent,
HomeComponent,
PageNotFoundComponent …Run Code Online (Sandbox Code Playgroud) javascript single-page-application angular angular7 angular7-router
我在下面的代码中有一个主要缺陷.每次递归工作(即函数被多次调用)时,由于var result = []表达式,它会覆盖数组.那么,为了避免这种情况,最好的方法是什么.我真的不想把结果变量放在函数的范围之外.我正在寻找的是最佳实践和更好的方法.
function getElementNames(obj){
//below line overwrites the previous result every time this function runs
var result = [];
if(!obj.parent){
result.push(obj.name);
}
else {
result.push(obj.name);
getElementNames(obj['parent'])
}
return result;
}
Run Code Online (Sandbox Code Playgroud)