mam z relaksującego Służby następujące dane:Obsada int do wyliczenia sznurki w maszynopisie
[
{
"id": 42,
"type": 0,
"name": "Piety was here",
"description": "Bacon is tasty, tofu not, ain't nobody like me, cause i'm hot...",
}...
I jestem mapowanie z tej klasy:
export enum Type {
Info,
Warning,
Error,
Fatal,
}
export class Message{
public id: number;
public type: Type:
public name: string;
public description: string;
}
Ale kiedy dostęp „typ” w Angular2 otrzymuję tylko wartość int. Ale chciałbym uzyskać wartość ciągu.
przykład:
'message.type=0'
{{message.type}} => should be Info
'message.type=1'
{{message.type}} => should be Warning
Czy jest to problem w czasie kompilacji lub problem z uruchomieniem? –
Kompiluje i działa dobrze. Dla '{{message.type}]' otrzymuję '0', ale chcę uzyskać' Info'. –