Hi all,

I'm trying to understand the advantages of making use of interfaces in 
typescript/angular2.

For Example I can have a Logon component which depend on a LoginService.

class LogonComponent{
    constructor(service: LogonService)
    {        
    }
}


In order to mock the logon service I can simply use another class 
'MockService' that implements all the members of 'LogonService'

var lg = new LogonComponent( new MockService());

       
So, why I should create an interface 'ILoginService (which LoginService and 
MockLoginService implement) and then have the LogonComponent require an 
ILoginService?

Massimiliano

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