我用的是Angular 17.2.0
版.和服务于
import { Injectable } from '@angular/core';
import { Signal, ReadOnlySignal } from '@angular/core';
@Injectable({
providedIn: 'root' // Make the service available throughout the application
})
export class CurrentTimeService {
private currentTimeInSeconds = new Signal<number>(); // throw Error in this line.
}
}
我想在最新的angular版本17.2.0
中创建一个服务,以获取基于in Angular signal
的currentTime