Angular2理解逻辑

时间:2017-02-17 09:35:35

标签: angular

使用onRefresh $ event

的服务
constructor(
    private dataService: DataService,
    private ngZone: NgZone,
) {
    this.dataService.onRefresh$.subscribe(()=> {
        this.doRefresh(this.dataService.findElement(this.elementId));
    });
}

doRefresh(element) {
    console.log(this.element.name, element.name);
    this.element = element || this.element;
    console.log(this.element.name, JSON.stringify(this.element) == JSON.stringify(element));

    //this.ngZone.run(() => {});
}

订阅组件

undefined "XXX"
XXX true

控制台输出

import hmac
import hashlib

# Compute hmac sha256 signature from payload + client secret
digester = hmac.new(
    UBER_CLIENT_SECRET,
    request.data,
    hashlib.sha256
)

# Parse json post data
event = request.get_json(force=True)

# Validate webhook signature for our app
if request.headers.get('X-Uber-Signature') == digester.hexdigest():
    pass

查看不刷新

如果取消注释 this.ngZone.run(()=> {}); 点击视图中的可点击项目 - 查看刷新

问题:为什么不自动刷新?

0 个答案:

没有答案