core.mjs:6643 ERROR RuntimeError: NG0203: effect() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.dev/errors/NG0203
effect函数的使用场景
Effects are rarely needed in most application code, but may be useful in specific circumstances. Here are some examples of situations where an effect might be a good solution:
Logging data being displayed and when it changes, either for analytics or as a debugging tool.
Keeping data in sync with window.localStorage.
Adding custom DOM behavior that can’t be expressed with template syntax.
Performing custom rendering to a <canvas>, charting library, or other third party UI library.
The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.
A positioned element is an element whose computed position value is either relative, absolute, fixed, or sticky. (In other words, it’s anything except static.)