question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🚀 - Use providers to inject default configurations

See original GitHub issue

🚀 Feature request

Is your feature request related to a problem?

I would like to adjust the default values for several inputs on different components. In our project for instance, we would like to use the checkbox component in size l. Given the current implementation, we need to add the size input to every checkbox. It would be nice to globally define the default values via a configuration provider. Similar functionality exists on Angular Material and other frameworks.

Describe the solution you’d like

import {TUI_CHECKBOX_DEFAULT_OPTIONS} from '@taiga-ui/kit';
...
{
  imports: [TuiRootModule, ...],
  providers: [{
    provide: TUI_CHECKBOX_DEFAULT_OPTIONS,
    useValue: {
      size: 'l'
    }
  }],
  ...
}
export class AppModule {}

Describe alternatives you’ve considered

The only alternative currently is to set the size input on every checkbox.

Additional context

Ideally, this would be available for every component and not only for checkboxes. We can help provide PRs if you like the idea.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
waterpleacommented, Apr 26, 2022

I believe the library is mostly covered by tokens now. If anything is still needed, a separate issue can be opened.

Huge thanks to everyone who contributed to getting this done, namely @fynnfeldpausch, @KarimovDev, @mullinsmikey and @zarghamkhandev, you rock! 👍

1reaction
waterpleacommented, Jun 15, 2021

@vladimirpotekhin could you add configuration for InputTime next, please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring dependency providers - Angular
If you specify the service class as the provider token, the default behavior is for the injector to instantiate that class using the...
Read more >
Angular 2 DI injects same instance of clonned object with ...
So the idea is to get default config of scrollbar and then extend injected object in each component, so each component has own...
Read more >
Overriding dependencies in the Angular injector hierarchy
Angular allows dependencies provided through the injector of a parent component to be shared among its child components by injecting them ...
Read more >
Configuration provider - Dependency Injector
This page demonstrates how to use Configuration provider to inject the dependencies, ... Dependency Injector doesn't install pydantic by default.
Read more >
Understand Angulars Hierarchical Dependency Injection system
By default, services registered to Angular are application wide but we ... messages = [ '10 rockets built', 'new configurations available' ]; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found