If you get the error 

> Cannot find name 'YOUTUBE_API_KEY'".

then probably something is expecting a `YOUTUBE_API_KEY`. This value is not 
used anyway in the code in your question.

You export `testServiceInjectables` but prvide `youTubeServiceInjectables`

You request `@Inject(TEST_API_KEY)` but the constant from further above is 
named `TEST_API_URL`

>  bind(TEST_API_URL).toValue(TEST_API_URL)

is derprecated syntax and using the value as key doesn't make sense.

It should probably be something like  `provide(TEST_API_KEY, {useValue: 
TEST_AIP_URL})`

Your question looks like generated by some random text generating service. 
I'm not able to make any sense of it

On Thursday, March 24, 2016 at 8:54:03 AM UTC+1, Miha Zoubek wrote:
>
> hi,
>
> need a little help with injecting constants in Angular2:
>
> /*models.ts*/
> import {Injectable,bind,Inject} from 'angular2/core';
>  
> export var TEST_API_URL: string = '
> https://www.googleapis.com/youtube/v3/search';
>  
>     export var testServiceInjectables: Array<any> = [
>         bind(TEST_API_URL).toValue(TEST_API_URL)
>     ];
>  
> /*boot.ts*/
>  
> import {testServiceInjectables} from './services/models';
> bootstrap(loginForm, [HTTP_PROVIDERS, youTubeServiceInjectables]);
>  
> /*app.ts*/
>  
> import {Injectable, bind, Component, Inject} from 'angular2/core';
>  
> export class test{
> constructor(public http: Http,
>         @Inject(TEST_API_KEY) private apiKey: string
>         ){
>     }
> }
>
> But getting all the time Cannot find name 'YOUTUBE_API_KEY'".
>
> I doing like tutorial in ng-book2 but i do not know what I am missing.
> tnx
> miha
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to