chore: update cheatsheet for new provider syntax (#9227)
This commit is contained in:
parent
27024915e4
commit
54c577cfe0
|
@ -8,11 +8,11 @@ Bootstrapping
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`bootstrap(MyAppComponent, [MyService, provide(...)]);`|`provide`
|
`bootstrap(MyAppComponent, [MyService, { provide: ... }]);`|`provide`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`document.addEventListener('DOMContentLoaded', function () {
|
`document.addEventListener('DOMContentLoaded', function () {
|
||||||
ng.platform.browser.bootstrap(MyAppComponent,
|
ng.platform.browser.bootstrap(MyAppComponent,
|
||||||
[MyService, ng.core.provide(...)]);
|
[MyService, { provide: ... }]);
|
||||||
});`|`provide`
|
});`|`provide`
|
||||||
description:
|
description:
|
||||||
Bootstraps an application with MyAppComponent as the root component and configures the DI providers. {@target js}Must be wrapped in the event listener to fire when the page loads.{@endtarget}
|
Bootstraps an application with MyAppComponent as the root component and configures the DI providers. {@target js}Must be wrapped in the event listener to fire when the page loads.{@endtarget}
|
||||||
|
|
|
@ -9,9 +9,9 @@ so the `@Directive` configuration applies to components as well{@endtarget}
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`viewProviders: [MyService, provide(...)]`|`viewProviders:`
|
`viewProviders: [MyService, { provide: ... }]`|`viewProviders:`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`viewProviders: [MyService, ng.core.provide(...)]`|`viewProviders:`
|
`viewProviders: [MyService, { provide: ... }]`|`viewProviders:`
|
||||||
description:
|
description:
|
||||||
Array of dependency injection providers scoped to this component's view.
|
Array of dependency injection providers scoped to this component's view.
|
||||||
|
|
||||||
|
|
|
@ -8,26 +8,26 @@ Dependency injection configuration
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`provide(MyService, {useClass: MyMockService})`|`provide`|`useClass`
|
`{ provide: MyService, useClass: MyMockService }`|`provide`|`useClass`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`ng.core.provide(MyService, {useClass: MyMockService})`|`provide`|`useClass`
|
`{ provide: MyService, useClass: MyMockService }`|`provide`|`useClass`
|
||||||
description:
|
description:
|
||||||
Sets or overrides the provider for MyService to the MyMockService class.
|
Sets or overrides the provider for MyService to the MyMockService class.
|
||||||
|
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`provide(MyService, {useFactory: myFactory})`|`provide`|`useFactory`
|
`{ provide: MyService, useFactory: myFactory }`|`provide`|`useFactory`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`ng.core.provide(MyService, {useFactory: myFactory})`|`provide`|`useFactory`
|
`{ provide: MyService, useFactory: myFactory }`|`provide`|`useFactory`
|
||||||
description:
|
description:
|
||||||
Sets or overrides the provider for MyService to the myFactory factory function.
|
Sets or overrides the provider for MyService to the myFactory factory function.
|
||||||
|
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`provide(MyValue, {useValue: 41})`|`provide`|`useValue`
|
`{ provide: MyValue, useValue: 41 }`|`provide`|`useValue`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`provide(MyValue, {useValue: 41})`|`provide`|`useValue`
|
`{ provide: MyValue, useValue: 41 }`|`provide`|`useValue`
|
||||||
description:
|
description:
|
||||||
Sets or overrides the provider for MyValue to the value 41.
|
Sets or overrides the provider for MyValue to the value 41.
|
||||||
|
|
|
@ -17,8 +17,8 @@ Does not support parent-child relationship selectors.
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`providers: [MyService, provide(...)]`|`providers:`
|
`providers: [MyService, { provide: ... }]`|`providers:`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`providers: [MyService, ng.core.provide(...)]`|`providers:`
|
`providers: [MyService, { provide: ... }]`|`providers:`
|
||||||
description:
|
description:
|
||||||
Array of dependency injection providers for this directive and its children.
|
Array of dependency injection providers for this directive and its children.
|
||||||
|
|
Loading…
Reference in New Issue