ngx_core 0.14.0 ngx_core: ^0.14.0 copied to clipboard
Core library for AngularDart. Provides essential services for any Angular-based application.
import 'package:angular/angular.dart';
import 'package:ngx_core/ngx_core.dart';
// ignore: uri_has_not_been_generated
import 'main.template.dart' as self;
/// The injector factory providing the top-level services.
@GenerateInjector([
ValueProvider.forToken(appConfig, <String, dynamic>{'name': 'Core Library for AngularDart'}),
ValueProvider.forToken(appEnv, 'production')
])
final InjectorFactory createInjector = self.createInjector$Injector; // ignore: prefer_const_declarations
/// A component that demonstrates the usage of the [Configuration] service.
@Component(
selector: 'configuration-demo',
providers: [ngxProviders],
template: '<div></div>'
)
class ConfigurationDemoComponent implements OnInit {
/// Creates a new demo component.
ConfigurationDemoComponent(this.config);
/// The configuration service.
final Configuration config;
/// Method invoked after the first change detection completed.
@override
void ngOnInit() {
print(config.keys); // ["name"]
print(config['name']); // "Core Library for AngularDart"
config['foo'] = 'bar';
print(config.keys); // ["name", "foo"]
print(config['foo']); // "bar"
}
}