Injectables not working in angular 2.0
Your compiler does not add parameters properties to the MyAppComponent
(from looking at your pluker). I think this is the problem. If you add
MyAppComponent.parameters = [[Names]]
then all will works well.
UPD Thanks to @GrayFox for pointing out the correct way (see the comment bellow):
For future references - use
--emitDecoratorMetadata
flag when using tsc or addemitDecoratorMetadata: true
to the configuration if you're using gulp-typescript
See TypeScript compiler options here (you can find emitDecoratorMetada
there).
Put this:
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' " > <DebugSymbols>true < /DebugSymbols> < TypeScriptRemoveComments > false < /TypeScriptRemoveComments> < TypeScriptSourceMap > true < /TypeScriptSourceMap> < TypeScriptAdditionalFlags > $(TypeScriptAdditionalFlags)--emitDecoratorMetadata < /TypeScriptAdditionalFlags> < /PropertyGroup> < PropertyGroup Condition= " '$(Configuration)' == 'Release' " > <DebugSymbols>true < /DebugSymbols> < TypeScriptRemoveComments > true < /TypeScriptRemoveComments> < TypeScriptSourceMap > false < /TypeScriptSourceMap> < TypeScriptAdditionalFlags > $(TypeScriptAdditionalFlags)--emitDecoratorMetadata < /TypeScriptAdditionalFlags> < /PropertyGroup>
into your *.njsproj file at the end.