/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
devtools/src/app/demo-app/sample.service.ts
39 строк
1 KB
Matthieu Riegler
refactor(devtools): Use `@Service` instead of `@Injectable`
23 апр 2026, 21:30
23 апр 2026, 21:30
c77f16d
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {computed, signal, Service} from '@angular/core'; @Service() export class SampleService { exampleBoolean = true; exampleString = 'John'; exampleSymbol = Symbol.iterator; exampleNumber = 40; exampleBigint = BigInt(40); exampleUndefined = undefined; exampleNull = null; exampleObject = {name: 'John', age: 40}; exampleArray = [1, 2, [3, 4], {name: 'John', age: 40, skills: ['JavaScript']}]; exampleSet = new Set([1, 2, 3, 4, 5]); exampleMap = new Map<unknown, unknown>([ ['name', 'John'], ['age', 40], [{id: 123}, undefined], ]); exampleDate = new Date(); exampleFunction = () => 'John'; signalPrimitive = signal(123); computedPrimitive = computed(() => this.signalPrimitive() ** 2); signalObject = signal({name: 'John', age: 40}); computedObject = computed(() => { const original = this.signalObject(); return {...original, age: original.age + 1}; }); }