diff --git a/samples/angular-search/src/webparts/angularSearch/AngularSearch.module.scss b/samples/angular-search/src/webparts/angularSearch/AngularSearch.module.scss index c499d2089..15f1f5066 100644 --- a/samples/angular-search/src/webparts/angularSearch/AngularSearch.module.scss +++ b/samples/angular-search/src/webparts/angularSearch/AngularSearch.module.scss @@ -19,3 +19,8 @@ text-decoration: none; } } + +//removes the checkbox from the hover event of ms-ListItem's +:global .ms-ListItem.is-selectable:hover:before { + border: none !important; +} \ No newline at end of file diff --git a/samples/angular-search/src/webparts/angularSearch/app/DataService.ts b/samples/angular-search/src/webparts/angularSearch/app/DataService.ts index 7f1f7fa0b..837dae840 100644 --- a/samples/angular-search/src/webparts/angularSearch/app/DataService.ts +++ b/samples/angular-search/src/webparts/angularSearch/app/DataService.ts @@ -13,7 +13,8 @@ export default class DataService implements IDataService { const deferred: ng.IDeferred = this.$q.defer(); this.$http({ - url: `${webUrl}/_api/search/query?queryText='ContentType:"${contentType}"'`, + url: `${webUrl}/_api/search/query?queryText='ContentType:"${contentType}" + Path:${webUrl}'&selectproperties='Title,Author,HitHighlightedSummary,PublishingImage,Url'`, method: 'GET', headers: { 'Accept': 'application/json;odata=verbose' diff --git a/samples/angular-search/src/webparts/angularSearch/app/HomeController.ts b/samples/angular-search/src/webparts/angularSearch/app/HomeController.ts index c87a6804f..09cfbb0d4 100644 --- a/samples/angular-search/src/webparts/angularSearch/app/HomeController.ts +++ b/samples/angular-search/src/webparts/angularSearch/app/HomeController.ts @@ -12,6 +12,7 @@ export default class HomeController { public styles: any = null; public searchNotConfigured: boolean = true; public items: any[] = []; + public searching: boolean = false; private _web: string = null; private _contentType: string = undefined; @@ -19,7 +20,7 @@ export default class HomeController { constructor(private dataService: IDataService, private $rootScope: ng.IRootScopeService, private $scope: ng.IScope, private $attrs: ng.IAttributes) { const vm: HomeController = this; - vm.styles = $attrs['style']; + vm.styles = angular.fromJson($attrs['style']); vm._web = $attrs['web']; vm._contentType = $attrs['contenttype'] === "" ? undefined : $attrs['contenttype']; @@ -55,11 +56,15 @@ export default class HomeController { } public getSearchResults(): void { - this.status = 'Loading search results...'; + //display searching message + this.searching = true; this.dataService.getSearchResults(this._web, this._contentType) .then((results: ISearchResults): void => { this.items = this._setSearchResults(results.PrimaryQueryResult.RelevantResults.Table.Rows.results); console.log(this.items); + + //hide searching message + this.searching = false; }); } @@ -71,7 +76,20 @@ export default class HomeController { var val: Object = {}; result.Cells.results.forEach((cell: ICellValue) => { + if (cell.Key == 'HitHighlightedSummary'){ + //need to replace markup + val[cell.Key] = cell.Value.replace(/ /g, '.'); + } + else if (cell.Key == 'PublishingImage' && cell.Value !== null) { + //need to pull image url out of PublishingImage field + let div = document.createElement('div'); + div.innerHTML = cell.Value; + let img = div.getElementsByTagName('img')[0]; + val[cell.Key] = img.src; + } + else { val[cell.Key] = cell.Value; + } }); temp.push(val); diff --git a/samples/angular-search/src/webparts/angularSearch/app/home-template.html b/samples/angular-search/src/webparts/angularSearch/app/home-template.html index 8f9719419..c7e858e4c 100644 --- a/samples/angular-search/src/webparts/angularSearch/app/home-template.html +++ b/samples/angular-search/src/webparts/angularSearch/app/home-template.html @@ -1,30 +1,40 @@ - -
-
-
-
- +
+
+
+
+ Sample SharePoint Search in Angular -
-
-
-
- - Refresh Search Results - -
-
-
-
-
{{vm.status}}
-
-
- - - {{item.Title}} - By: {{item.Author}} - {{item.HitHighlightedSummary}} - -
+ + + +
+
+
+
+ Searching... +
+
+
+
+
+ + +
+
+ + + + + {{item.Title}} + By: {{item.Author}} + {{item.HitHighlightedSummary}} + +
+
+
+
+
+
+
\ No newline at end of file