Hi,

I've played around with the viewProviders and providers Properties and 
created the below mentioned sample. I would have expected, that the showed 
component, BookFlights, gets the FlightManager defined with the 
providers-property and that it's children get the FlightManager defined 
with viewProviders. But instead of this, in both cases the FlightManager 
defined by the providers property is used. 

When I omit the viewProviders property, both cases use the FlightManager 
from the providers property.

Did I do something wrong?

Wishes,
Manfred


@Component({
    templateUrl: 'app/flug-buchen/flug-buchen.html',
    directives: [ROUTER_DIRECTIVES, FlugSuchen],
    viewProviders: [FlightManager],
    providers: [provide(FlightManager, {useValue: {dummy:true}})]
})
@RouteConfig([
   { path: '/flug-suchen', component: FlugSuchen, as: 'FlugSuchen', 
useAsDefault: true },
    { path: '/passagier-suchen', component: PassagierSuchen, as: 
'PassagierSuchen' },
    { path: '/buchen', component: Buchen, as: 'Buchen'},
    { path: '/flug-edit/:id', component: FlugEdit, as: 'FlugEdit' }
])
export class BookFlights {
    
    constructor(private location: Location, flightManager: FlightManager) {
        console.debug("FlightManager");
        console.debug(<any>flightManager);
    }
}


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