Skip to content

Commit 8529b26

Browse files
feat(deps): adds support for Angular 19 and migrates the component to a fully standalone structure
BREAKING CHANGE: YES GH-42
1 parent c900436 commit 8529b26

File tree

22 files changed

+13198
-10830
lines changed

22 files changed

+13198
-10830
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: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
SearchComponent is now a standalone component, so no NgModule is required.Simply import the `SearchComponent` component in your application.
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)