Skip to content

Commit 8f7f7e3

Browse files
feat(deps): adds support for Angular 19 and migrates the component to a fully standalone structure (#45)
BREAKING CHANGE: YES ## Description This pull request modernizes the `@sourceloop/search-client` library and its example by upgrading to Angular 19, refactoring the search component to be standalone, and updating documentation and configuration to reflect these changes. The updates simplify integration for consumers and leverage Angular's latest features for improved modularity and maintainability. Fixes #42 ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Intermediate change (work in progress) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Test A - [ ] Test B ## Checklist: - [ ] Performed a self-review of my own code - [ ] npm test passes on your machine - [ ] New tests added or existing tests modified to cover all changes - [ ] Code conforms with the style guide - [ ] API Documentation in code was updated - [ ] Any dependent changes have been merged and published in downstream modules
1 parent 6605b2d commit 8f7f7e3

File tree

22 files changed

+13189
-10833
lines changed

22 files changed

+13189
-10833
lines changed

package-lock.json

Lines changed: 2186 additions & 780 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/search/README.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ An Angular module that exports a component that can enable users to search over
44

55
### Deprecation Notice
66

7-
Search-client now supports Angular v17, we will provide support for the older version that is based on Angular v14 till 30th August 2025 .
7+
Search-client now supports Angular v19, we will provide support for the older version that is based on Angular v17 till 31st March 2026 .
88

99
## Angular Module
1010

@@ -16,33 +16,21 @@ npm i @sourceloop/search-client
1616

1717
### Usage
1818

19-
Create a new Application using Angular CLI and import the SearchLibModule and add it to the imports array of the module. Also create a new service that implements the ISearchService interface exported by the search library. This service will be used by the exported component to make API calls whenever needed. You will have to update the providers section of your module with { provide: SEARCH_SERVICE_TOKEN, useExisting: Your_Service_Name }
20-
Your module will then look something like this
19+
Create a new Application using Angular CLI and import the `SearchComponent` in your application.SearchComponent is now a standalone component, so no NgModule is required.Also create a new service that implements the ISearchService interface exported by the search library. This service will be used by the exported component to make API calls whenever needed. You will have to update the providers section of your module with { provide: SEARCH_SERVICE_TOKEN, useExisting: Your_Service_Name }
2120

2221
```ts
23-
import {NgModule} from '@angular/core';
24-
import {BrowserModule} from '@angular/platform-browser';
25-
26-
import {AppComponent} from './app.component';
27-
28-
import {HttpClientModule} from '@angular/common/http';
29-
import {XComponent} from './x/x.component';
30-
import {ReactiveFormsModule} from '@angular/forms';
31-
32-
import {SearchLibModule, SEARCH_SERVICE_TOKEN} from 'search-lib';
33-
import {SearchService} from './search.service';
34-
@NgModule({
35-
declarations: [AppComponent, XComponent],
36-
imports: [
37-
BrowserModule,
38-
SearchLibModule, //import SearchLibModule
39-
HttpClientModule,
40-
ReactiveFormsModule,
41-
],
42-
providers: [{provide: SEARCH_SERVICE_TOKEN, useClass: SearchService}], //Add your service here
43-
bootstrap: [AppComponent],
22+
import { Component } from '@angular/core';
23+
import { SearchComponent, SEARCH_SERVICE_TOKEN } from '@sourceloop/search-client';
24+
import { SearchService } from './search.service';
25+
26+
@Component({
27+
selector: 'app-root',
28+
standalone: true,
29+
imports: [SearchComponent],
30+
templateUrl: './app.component.html',
31+
providers: [{ provide: SEARCH_SERVICE_TOKEN, useClass: SearchService }],
4432
})
45-
export class AppModule {}
33+
export class AppComponent {}
4634
```
4735

4836
### Search Service

packages/search/angular.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"extract-i18n": {
9898
"builder": "@angular-devkit/build-angular:extract-i18n",
9999
"options": {
100-
"browserTarget": "SearchElement:build"
100+
"buildTarget": "search-element:build"
101101
}
102102
},
103103
"test": {
@@ -118,6 +118,5 @@
118118
}
119119
}
120120
}
121-
},
122-
"defaultProject": "search-lib"
121+
}
123122
}

0 commit comments

Comments
 (0)