小编kal*_*mas的帖子

正确的方法使用Angular 2 RC6为Component提供DomSanitizer

我正在尝试使用DomSanitizer来清理组件中的动态URL,我似乎无法弄清楚为此服务指定Provider的正确方法是什么.

我正在使用Angular 2.0.0-rc.6

这是我目前的组成部分:

@Component({
    templateUrl: './app.component.html',
    styleUrls: [ './app.component.css' ],
    providers: [ DomSanitizer ],
})
export class AppComponent implements OnInit
{
    public url: SafeResourceUrl;

    constructor(private sanitizer: DomSanitizer) {}

    ngOnInit() {
        let id = 'an-id-goes-here';
        let url = `https://www.youtube.com/embed/${id}`;

         this.videoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
    }

    ngOnDestroy() {}
}
Run Code Online (Sandbox Code Playgroud)

这会导致this.sanitizer.bypassSecurityTrustResourceUrl is not a function运行时出错.

有人能告诉我一个如何正确提供DomSanitizer提供商的例子吗?谢谢!

javascript typescript angular-services angular angular-dom-sanitizer

36
推荐指数
3
解决办法
5万
查看次数

使用根对象的Logstash合并字段

我有logstash输入,看起来像这样

{
    "@timestamp": "2016-12-20T18:55:11.699Z",
    "id": 1234,
    "detail": {
        "foo": 1
        "bar": "two"
    }
}
Run Code Online (Sandbox Code Playgroud)

我想将"detail"的内容与根对象合并,以便最终事件如下所示:

{
    "@timestamp": "2016-12-20T18:55:11.699Z",
    "id": 1234,
    "foo": 1
    "bar": "two"
}
Run Code Online (Sandbox Code Playgroud)

有没有办法在不编写自己的过滤器插件的情况下完成此操作?

logstash logstash-configuration

3
推荐指数
1
解决办法
2195
查看次数