Merge pull request #436 from strongloop/enum
fix(docs): update enum type
This commit is contained in:
commit
c681b2dbe7
18
README.md
18
README.md
|
@ -434,23 +434,7 @@ startTime: Date;
|
||||||
|
|
||||||
### Enum
|
### Enum
|
||||||
|
|
||||||
Enums are special. Create an Enum using Enum factory:
|
See the [Model ENUM property](https://loopback.io/doc/en/lb4/Model.html#enum-property) for details.
|
||||||
|
|
||||||
```ts
|
|
||||||
const MOOD = dataSource.EnumFactory('glad', 'sad', 'mad');
|
|
||||||
MOOD.SAD; // 'sad'
|
|
||||||
MOOD(2); // 'sad'
|
|
||||||
MOOD('SAD'); // 'sad'
|
|
||||||
MOOD('sad'); // 'sad'
|
|
||||||
|
|
||||||
export class User extends Entity {
|
|
||||||
//..
|
|
||||||
@property({
|
|
||||||
type: MOOD,
|
|
||||||
})
|
|
||||||
mood: MOOD;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Default Clause/Constant
|
### Default Clause/Constant
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue