Günter Zöchbauer, Thanks! 

On Friday, February 5, 2016 at 10:24:26 PM UTC+11, Günter Zöchbauer wrote:
>
> See also 
> http://stackoverflow.com/questions/35206821/angular2-access-global-service-without-including-it-in-every-constructor/35207105#35207105
>
> On Friday, February 5, 2016 at 12:16:48 PM UTC+1, Günter Zöchbauer wrote:
>>
>> I forgot to mention that I replaced `implements` by `extends`
>>
>> with `implements` you don't call `super()` but you still need to 
>> implement the constructor. 
>>
>> class Oldman implements Person{
>>   private massageService : MassageService;
>>   constructor(massageService: MassageService){ // you can't avoid 
>> implementing the constructor in each subclass
>>  
>>   } 
>> }
>>
>> On Friday, February 5, 2016 at 12:14:02 PM UTC+1, Günter Zöchbauer wrote:
>>>
>>> class Oldman extends Person{
>>>   constructor(massageService: MassageService){ // you can't avoid 
>>> implementing the constructor in each subclass
>>>     super(messageService); // super must be first line in constructor   
>>>           
>>>   } 
>>> }
>>>
>>> On Friday, February 5, 2016 at 12:55:11 AM UTC+1, Long Field wrote:
>>>>
>>>> Hi All
>>>> Basically, super class has construction injection  and child class 
>>>> implement super class, how to do this? below link gives a solution, but I 
>>>> am not sure what it is, 
>>>>
>>>>
>>>> http://willseitz-code.blogspot.com.au/2015/08/angular-and-typescript-inheritance-and.html?showComment=1454628375575
>>>>
>>>>
>>>> @Injectable()
>>>> class MassageService{
>>>>     public getMassage(){ console.log("relax!")}
>>>> }
>>>>
>>>> @Component({
>>>> providers [MassageService]
>>>> })
>>>>
>>>> class Person{
>>>>   private massageService : MassageService;
>>>> constructor(massageService: MassageService)
>>>> }
>>>>
>>>>
>>>> *****************************
>>>> class Oldman implements Person{
>>>>          constructor(){} ????????????
>>>> }
>>>>
>>>

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