angular/packages/compiler-cli/test/ngtsc
Kristiyan Kostadinov 8f3d0b9d97 feat(core): introduce @Service decorator
These changes introduce the new `@Service` decorator which is a more ergonomic alternative to `@Injectable`. The reason we're adding a new decorator is that `@Injectable` has been around since the beginning of Angular and it has a lot of baggage that adds unnecessary overhead for users that generally want to define a singleton service, available in their entire app. The key differences between `@Service` and `@Injectable` are:
1. `@Service` is `providedIn: 'root'` by default. You can opt into providing the service yourself by setting `autoProvided: false` on it.
2. `@Service` doesn't allow constructor-based injection, only the `inject` function.
3. `@Service` doesn't support the complex type signature of `@Injectable` (`useClass`, `useValue` etc.). Instead it supports a single `factory` function.

Example:

```ts
import {Service} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {AuthService} from './auth';

@Service()
export class PostService {
  private readonly httpClient = inject(HttpClient);
  private readonly authService = inject(AuthService);

  getUserPosts() {
    return this.httpClient.get('/api/posts/' + this.authService.userId);
  }
}
```
2026-04-22 11:01:01 -07:00
..
doc_extraction build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
attach_source_location_spec.ts refactor(compiler): produce DOM-only instructions (#62096) 2025-06-23 14:24:09 +02:00
authoring_diagnostics_spec.ts feat(core): add support for TypeScript 6 2026-02-17 08:40:38 -08:00
authoring_inputs_spec.ts fix(compiler-cli): capture metadata for undecorated fields (#63957) 2025-10-09 14:02:16 -04:00
authoring_models_spec.ts fix(compiler-cli): capture metadata for undecorated fields (#63957) 2025-10-09 14:02:16 -04:00
authoring_outputs_spec.ts fix(compiler-cli): capture metadata for undecorated fields (#63957) 2025-10-09 14:02:16 -04:00
authoring_queries_spec.ts perf(compiler): chain query creation instructions 2025-12-09 09:24:36 -08:00
BUILD.bazel refactor(compiler-cli): allow the forms module to be loaded in tests 2025-11-05 17:35:43 +00:00
component_indexing_spec.ts build: migrate packages/compiler-cli to ts_project (#61826) 2025-06-03 11:41:52 +02:00
debug_transform_spec.ts refactor(compiler): update tests after codegen changes 2026-03-16 09:58:18 -06:00
declaration_only_emission_spec.ts build: initial test of TypeScript 6 2026-01-15 13:41:01 -08:00
defer_spec.ts refactor(compiler): update tests after codegen changes 2026-03-16 09:58:18 -06:00
env.ts refactor(compiler): remove fullTemplateTypeCheck compiler option. 2026-03-23 11:33:15 -07:00
extended_template_diagnostics_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
hmr_spec.ts build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
host_bindings_type_check_spec.ts fix(compiler-cli): animation events not type checked properly when bound through HostListener decorator 2026-04-13 11:05:16 +03:00
host_directives_spec.ts refactor(compiler-cli): merge duplicate directive matches and report conflicts 2026-04-03 09:44:39 -07:00
imports_spec.ts build: initial test of TypeScript 6 2026-01-15 13:41:01 -08:00
incremental_error_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
incremental_semantic_changes_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
incremental_spec.ts refactor(compiler): remove fullTemplateTypeCheck compiler option. 2026-04-06 11:55:09 -07:00
incremental_typecheck_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
local_compilation_spec.ts refactor(compiler): add ts-ignore comment on factory functions 2026-03-18 14:05:18 -06:00
ls_typecheck_helpers_spec.ts refactor: clean up explicit standalone flags from tests (#63963) 2025-09-22 14:27:34 +00:00
monorepo_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
ngtsc_spec.ts fix(compiler-cli): error for type parameter declarations 2026-04-07 09:29:29 -07:00
scope_spec.ts refactor(compiler): remove fullTemplateTypeCheck compiler option. 2026-04-06 11:55:09 -07:00
selectorless_spec.ts refactor(compiler): update tests after codegen changes 2026-03-16 09:58:18 -06:00
service_spec.ts feat(core): introduce @Service decorator 2026-04-22 11:01:01 -07:00
signal_forms_spec.ts feat(forms): support binding number|null to <input type="text"> 2026-03-19 15:26:34 -07:00
sourcemap_utils.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
standalone_spec.ts refactor: clean up explicit standalone flags from tests (#63963) 2025-09-22 14:27:34 +00:00
template_mapping_spec.ts refactor: various build and import specificer fixes for strict deps (#63323) 2025-08-22 14:45:00 -07:00
template_typecheck_spec.ts feat(compiler): allow safe navigation to correctly narrow down nullables 2026-04-09 18:26:08 +03:00
util.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
xi18n_spec.ts build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00