本文整理匯總了TypeScript中app/shared/location.service.LocationService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.LocationService類的具體用法?TypeScript service.LocationService怎麽用?TypeScript service.LocationService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了service.LocationService類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: ngOnInit
ngOnInit() {
const query = this.locationService.search()['search'];
if (query) {
this.searchBox.nativeElement.value = query;
this.onSearch(query);
}
}
示例2: onSearch
onSearch(query: string, keyCode?: number) {
if (keyCode === 27) {
// Ignore escape key
return;
}
this.locationService.setSearch('Full Text Search', { search: query });
this.searchService.search(query);
}
示例3: ngOnInit
ngOnInit() {
const groupName = this.locationService.search()['group'] || '';
// no need to unsubscribe because `contributors` completes
this.contributorService.contributors
.subscribe(grps => {
this.groups = grps;
this.groupNames = grps.map(g => g.name);
this.selectGroup(groupName);
});
}
示例4: ngOnInit
ngOnInit() {
this.searchService.initWorker('app/search/search-worker.js');
this.searchService.loadIndex();
const query = this.locationService.search()['search'];
if (query) {
this.searchBox.nativeElement.value = query;
this.onSearch(query);
}
}
示例5: selectGroup
selectGroup(name) {
name = name.toLowerCase();
this.selectedGroup = this.groups.find(g => g.name.toLowerCase() === name) || this.groups[0];
this.locationService.setSearch('', {group: this.selectedGroup.name});
}