本文整理汇总了TypeScript中@providers/sites.CoreSitesProvider.getSites方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreSitesProvider.getSites方法的具体用法?TypeScript CoreSitesProvider.getSites怎么用?TypeScript CoreSitesProvider.getSites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@providers/sites.CoreSitesProvider
的用法示例。
在下文中一共展示了CoreSitesProvider.getSites方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
/**
* Component being initialized.
*/
ngOnInit(): void {
if (!this.filePath) {
this.domUtils.showErrorModal('Error reading file.');
this.navCtrl.pop();
return;
}
const fileAndDir = this.fileProvider.getFileAndDirectoryFromPath(this.filePath);
this.fileName = fileAndDir.name;
// Get the file.
this.fileProvider.getExternalFile(this.filePath).then((fe) => {
this.fileEntry = fe;
this.fileName = this.fileEntry.name;
}).catch(() => {
this.domUtils.showErrorModal('Error reading file.');
this.navCtrl.pop();
});
// Get the sites.
this.sitesProvider.getSites().then((sites) => {
this.sites = sites;
}).finally(() => {
this.loaded = true;
});
}
示例2: ngOnInit
ngOnInit(): void {
this.selectedSite = this.initialSite || this.sitesProvider.getCurrentSiteId();
// Load the sites.
this.sitesProvider.getSites().then((sites) => {
const promises = [];
sites.forEach((site: any) => {
// Format the site name.
promises.push(this.textUtils.formatText(site.siteName, true, true).catch(() => {
return site.siteName;
}).then((formatted) => {
site.fullNameAndSiteName = this.translate.instant('core.fullnameandsitename',
{ fullname: site.fullName, sitename: formatted });
}));
});
if (!this.selectedSite && sites.length) {
// There is no current site, select the first one.
this.selectedSite = sites[0].id;
this.siteSelected.emit(this.selectedSite);
}
return Promise.all(promises).then(() => {
this.sites = sites;
});
});
}
示例3:
this.contentLinksDelegate.getActionsFor(this.url).then((actions) => {
this.action = this.contentLinksHelper.getFirstValidAction(actions);
if (!this.action) {
return Promise.reject(null);
}
// Get the sites that can perform the action.
return this.sitesProvider.getSites(this.action.sites).then((sites) => {
this.sites = sites;
});
}).catch(() => {