本文整理匯總了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(() => {