Hi, i d'ont understand why the following snippet don't works and print 
error 'TypeError: Cannot read property 'test' of undefined' when i invoke 
the method : 

@Injectable()
export class HeroService {
        test = '1';
 
        getHeroesSlowly() {
                return new Promise(function(resolve, reject) {
 
                        if (this.test=='1') {
                                 setTimeout(()=>resolve(HEROES), 4000) // 2 
seconds
                        } else {
                                  reject('No user');
                }
                }); 
        }
}


And how i can display logs in console? 'console.log('log') not works.

thanks!

-- 
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