本文整理汇总了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});
}