
committed by
Igor Minar

parent
e950dd6a2a
commit
2835265916
@ -2,26 +2,32 @@
|
||||
Dependency injection configuration
|
||||
@cheatsheetIndex 9
|
||||
@description
|
||||
{@target js ts}`import {provide} from 'angular2/core';`{@endtarget}
|
||||
{@target ts}`import {provide} from 'angular2/core';`{@endtarget}
|
||||
{@target js}Available from the `ng.core` namespace{@endtarget}
|
||||
{@target dart}`import 'package:angular2/core.dart';`{@endtarget}
|
||||
|
||||
@cheatsheetItem
|
||||
syntax:
|
||||
syntax(ts dart):
|
||||
`provide(MyService, {useClass: MyMockService})`|`provide`|`useClass`
|
||||
syntax(js):
|
||||
`ng.core.provide(MyService, {useClass: MyMockService})`|`provide`|`useClass`
|
||||
description:
|
||||
Sets or overrides the provider for MyService to the MyMockService class.
|
||||
|
||||
|
||||
@cheatsheetItem
|
||||
syntax:
|
||||
syntax(ts dart):
|
||||
`provide(MyService, {useFactory: myFactory})`|`provide`|`useFactory`
|
||||
syntax(js):
|
||||
`ng.core.provide(MyService, {useFactory: myFactory})`|`provide`|`useFactory`
|
||||
description:
|
||||
Sets or overrides the provider for MyService to the myFactory factory function.
|
||||
|
||||
|
||||
@cheatsheetItem
|
||||
syntax:
|
||||
syntax(ts dart):
|
||||
`provide(MyValue, {useValue: 41})`|`provide`|`useValue`
|
||||
syntax(js):
|
||||
`provide(MyValue, {useValue: 41})`|`provide`|`useValue`
|
||||
description:
|
||||
Sets or overrides the provider for MyValue to the value 41.
|
||||
|
||||
|
Reference in New Issue
Block a user