我有这个控制器:
(function () {
"use strict";
angular.module('damageEvent').controller("inspectionsDamageEventsController", ["siteId", "mapguideService",
inspectionsDamageEventsController]);
function inspectionsDamageEventsController(siteId, mapguideService, inspectionsDamageList)
{
var self = this;
this.siteId = siteId;
this.mapguideService = mapguideService;
this.isMapGuideEnabled = mapguideService.enabled;
self.mapguideService.zoom("site", self.siteId);
}
})();
此行在页面加载时触发:
self.mapguideService.zoom("site", self.siteId);
我需要根据此值在页面加载时触发上面的行:
this.isMapGuideEnabled
如果isMapGuideEnabled
为真,则mapguideService.zoom()会被触发,否则不会。
如何在页面加载时设置此条件?
答案 0 :(得分:0)
if
救援......
(function () {
"use strict";
angular.module('damageEvent').controller("inspectionsDamageEventsController", ["siteId", "mapguideService",
inspectionsDamageEventsController]);
function inspectionsDamageEventsController(siteId, mapguideService, inspectionsDamageList)
{
var self = this;
this.siteId = siteId;
this.mapguideService = mapguideService;
this.isMapGuideEnabled = mapguideService.enabled;
if (this.isMapGuideEnabled) {
self.mapguideService.zoom("site", self.siteId);
}
}
})();