is possible to create in angular 2 Map< String, List< String >>?
Asked
Active
Viewed 2.0k times
2
-
Can you be a bit more precise please? – Filip Lauc Aug 30 '16 at 09:43
-
could you please explain a bit more of what you want to achieve. loop through some collection and return a value of type? < String, List< String >>. Or something like this? http://stackoverflow.com/questions/13631557/typescript-objects-as-dictionary-types-as-in-c-sharp – Marcel Hoekstra Aug 30 '16 at 09:49
1 Answers
13
Map is ES6 feature and have nothing to do with Angular 2. You can create it using
var map = new Map<string, string[]>();
map.set('key', ['a', 'b', 'c']);
map.get('key');
You also need to set "module": "es6" in your tsconfig.json or use es6-shims definitions.

Andzej Maciusovic
- 4,306
- 1
- 29
- 40