【发布时间】:2015-07-31 04:36:39
【问题描述】:
当方向改变时,我有动态改变模板。
出于这个原因,我禁用了缓存,但即使在非常强大的设备上它也非常慢。
因此我需要缓存这两个视图,但仍然能够看到模板发生变化,我该如何实现呢?
$stateProvider.state("app.timesheet", {
cache: false,
url: "/timesheet",
views: {
"menuContent": {
templateUrl: () => {
var orientation: number = ( < any > window).orientation;
if (orientation === 90 || orientation === -90) { // Landscape
return "views/timesheet/landscape.html"
} else if (orientation === 0 || orientation === 180 || orientation === -180) { // Portrait
return "views/timesheet/portrait.html";
}
},
controller: "TimesheetController"
}
},
data: {
requireAuthorize: true
}
});
【问题讨论】:
标签: caching typescript angular-ui-router ionic