Angular Dynamic Class

17 views
Skip to first unread message

Ronald Faircloth

unread,
Jan 22, 2020, 7:23:12 AM1/22/20
to Angular and AngularJS discussion
I have an MS SQL Server database.  This database contains statistics for users to fill out monthly.  The site administrators can add and remove fields they want so the form needs to be dynamic.  I'm new to Angular and from what I have seen through the Heroes tutorial and other explanations there should be a class that defines your object.  So, I should have a class that is something like this:

export class Stats{
    stat_field1: number;
    stat_field2: number;
    stat_field3: number;
    stat_field4: number;
}

Then in my component's TS file I will need to reference this object definition as I create the object to pass back to the database.  My question is, if these fields are dynamic, how do I define this class?

Thank you in advance,

Ronnie

Nhut Thai Le

unread,
Jan 22, 2020, 10:12:59 AM1/22/20
to ang...@googlegroups.com
Hello,
In a strongly typed language like java or c#, i would use a HashMap but other typescript expert out there may have better opinion which I am also interested in.

Thai

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/a3871c76-b55f-4cae-942d-e496fd568600%40googlegroups.com.


--
Castor Technologies Inc
460 rue St-Catherine St Ouest, Suite 613 
Montréal, Québec H3B-1A7

CONFIDENTIALITY NOTICE: The information contained in this e-mail is confidential and may be proprietary information intended only for the use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any viewing, dissemination, distribution, disclosure, copy or use of the information contained in this e-mail message is strictly prohibited. If you have received and/or are viewing this e-mail in error, please immediately notify the sender by reply e-mail, and delete it from your system without reading, forwarding, copying or saving in any manner. Thank you.
AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est confidentiel, peut être protégé par le secret professionnel et est réservé à l'usage exclusif du destinataire. Toute autre personne est par les présentes avisée qu'il lui est strictement interdit de diffuser, distribuer ou reproduire ce message. Si vous avez reçu cette communication par erreur, veuillez la détruire immédiatement et en aviser l'expéditeur. Merci.
Reply all
Reply to author
Forward
0 new messages