lundi 10 avril 2017

Best design pattern for constant strings using Typescript (or Javascript)?

I have a view that has two modes - view and edit. I'm using angular so I will be using some directives to change the behavior of the page based on what mode it's in. I know it's common in C to #DEF some constant strings for use later. I was wondering if there is a good design pattern similar to this for use in JS. For example I will be doing something like:

    <input ng-if="mode==='edit'"></input>

Notice the string literal 'edit'

Aucun commentaire:

Enregistrer un commentaire