我剛剛實現了ag-grid,但發現在使用cellTemplates和角編譯模板的時候,IE9崩潰了。ag-grid + templateUrl在IE9中崩潰
你們有沒有遇到過這種情況,也許找到了解決辦法?
如何重現:
這裏頭(http://www.ag-grid.com/angular-grid-cell-template/index.php)與IE瀏覽器,並從DevTools,選擇IE9。
由於角度編譯的模板,它會崩潰。不知道我能做些什麼。
(我也GitHub上開設了一個問題,在此:https://github.com/ceolter/ag-grid/issues/521)
編輯:
調試的話,有一個無限循環,因爲更新從一個方法數組,是不是另一種方法可見以某種方式...
無限循環是: getTemplate,(等待直到通話結束),通話結束,模板添加到緩存,運行回調,回調看不到templateCache中的模板,創建另一個回調,將其添加到隊列中,依此類推。 (代碼來自下面的ag-grid)。
// returns the template if it is loaded, or null if it is not loaded
// but will call the callback when it is loaded
TemplateService.prototype.getTemplate = function (url, callback) {
var templateFromCache = this.templateCache[url];
if (templateFromCache) {
return templateFromCache;
}
var callbackList = this.waitingCallbacks[url];
var that = this;
if (!callbackList) {
// first time this was called, so need a new list for callbacks
callbackList = [];
this.waitingCallbacks[url] = callbackList;
// and also need to do the http request
var client = new XMLHttpRequest();
client.onload = function() {
that.handleHttpResult(this, url);
};
client.open("GET", url);
client.send();
}
// add this callback
if (callback) {
callbackList.push(callback);
}
// caller needs to wait for template to load, so return null
return null;
};
TemplateService.prototype.handleHttpResult = function (httpResult, url) {
if (httpResult.status !== 200 || httpResult.response === null) {
console.warn('Unable to get template error ' + httpResult.status + ' - ' + url);
return;
}
// response success, so process it
this.templateCache[url] = httpResult.response;
// inform all listeners that this is now in the cache
var callbacks = this.waitingCallbacks[url];
for (var i = 0; i < callbacks.length; i++) {
var callback = callbacks[i];
// we could pass the callback the response, however we know the client of this code
// is the cell renderer, and it passes the 'cellRefresh' method in as the callback
// which doesn't take any parameters.
callback();
}
if (this.$scope) {
var that = this;
setTimeout(function() {
that.$scope.$apply();
}, 0);
}
};
return TemplateService;
})();